Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
shirleyc40
Creator
Creator

weekly sum is different from individual sum

Hi, I'm trying to sum up sales by distinct ID, and I used this function: 

 sum({<CustomerStatusDescription = {'Paid'}>}aggr( sum(Distinct Sales), CustomerID)). The dimension is a drill down of the date. And so for Week 29, the dates I have are 7/12, - 7/18, and the individual day sums are correct, but when I look at the week sum, its a lot lower.  

 

shirleyc40_0-1595361588374.png

The yellow line is the paid status, but all of them act like this.

Hovering it says the for 7/16 the total for paid status is 585. But once I expand into 7/16, the total turns into 2,600.97 (which is correct)

Customer IDDateSales
405277/17/20434.97
360567/16/20585
469547/16/202015.97
469547/17/202015.97
474967/17/20 2173.5
475167/17/20 833.5

 

 

Labels (1)
1 Solution

Accepted Solutions
Vegar
MVP
MVP

It could also be that you are note aggregating correctly you need week/date in the aggregatin as well. 

sum({<CustomerStatusDescription = {'Paid'}>}aggr( sum(Distinct Sales), CustomerID, Week))

or 

sum({<CustomerStatusDescription = {'Paid'}>}aggr( sum(Distinct Sales), CustomerID, Date))

depending on which dimension you are viewing in your chart.

View solution in original post

3 Replies
Vegar
MVP
MVP

My first guess (as I don't know how your data is connected) is that it got to do with the field CustomerStatusDescription. What happens if you make a selection on 'Paid', is the result correct then? 

If so then try to add the CustomerStatusDescription modifier to the inner aggregation as well (you might not need it in the outer sum). Like this :

sum({<CustomerStatusDescription = {'Paid'}>}aggr( sum({<CustomerStatusDescription = {'Paid'}>Distinct Sales), CustomerID)).

shirleyc40
Creator
Creator
Author

using paid as the status filter works with the current equation. I tried moving the condition inside the aggregation sum, but it still says 585.

Vegar
MVP
MVP

It could also be that you are note aggregating correctly you need week/date in the aggregatin as well. 

sum({<CustomerStatusDescription = {'Paid'}>}aggr( sum(Distinct Sales), CustomerID, Week))

or 

sum({<CustomerStatusDescription = {'Paid'}>}aggr( sum(Distinct Sales), CustomerID, Date))

depending on which dimension you are viewing in your chart.