Forum Discussion
Cumulative SUM group by date
- Anonymous8 years ago
Bian,
You can create the measure using dax below.Measure = CALCULATE(DISTINCTCOUNT(CustomerDetail[account]),FILTER(ALL(CustomerDetail),CustomerDetail[Month]<=MAX(CustomerDetail[Month])))
Regards,
Lydia - 8 years ago
Thank you Lydia.
Managed to find a similiar solution and this is my final measure:
[Measure] = CALCULATE(DISTINCTCOUNT(CustomerDetail[account]);Account[IsCustomer] = TRUE;filter(all(CustomerDetail[todate])CustomerDetail[todate]<=max(CustomerDetail[todate]));all(DimDate))
Where:
CustomerDetail is my table for customer deals.
Account is my customer table
CustomerDetail[todate] is my date for when the deal ends.
DimDate is my date table that I use on the X axis on the Chart.
If you had a separate Month table, you could use that as your axis and then simply do a SUM with a CALCULATE and FILTER the fact table to Fact[Month] <= Date[Month], something along those lines.
- Bian8 years ago
Helper II
Came up with the following formula based on your suggestion.
Cumulative =CALCULATE(DISTINCTCOUNT(CustomerDetail[account]);all(CustomerDetail);FILTER(CustomerDetail;CustomerDetail[todate]<=RELATED(dimdate[date])))
The result is the same as without the filter.
- Greg_Deckler8 years ago
Community Champion
Perhaps remove your ALL clause or structure it this way:
Cumulative =CALCULATE(DISTINCTCOUNT(CustomerDetail[account]);FILTER(all(CustomerDetail);CustomerDetail[todate]<=RELATED(dimdate[date])))