Forum Discussion
oscarII
10 years agoNew Member
cumulative for certain period
We are creating a measure to cumulate Sales figures, so we can see cumulated sales for the last month/year etc, or any filtered period. The table we are summing contains a line for each invoice line ...
- 10 years ago
oscarII - OK played with this a bit, tested some things out and fixed a column format issue on my end. Here is what I came up with that I believe will get you what you want:
Cumulative 2 = CALCULATE ( SUM ( 'Invoice lines'[Sales] ), FILTER ( ALLSELECTED(BI-Dates), 'BI-Dates'[Date] <= MAX ( 'BI-Dates'[Date] ) ) )The ALLSELECTED restricts the table returned to only the time range selected. I was able to put BI-Dates[Date] and Cumulative 2 in a table and watch the running total add up each day. I also used a [Month] column from BI-Dates and was able to get different (correct) cumulative totals for January versus February.
Anonymous
8 years agoNot applicable
Any one know why it does this?
I've selected previous 12 calendar months.
Anonymous
7 years agoNot applicable
Expanding on ChristianH comments, I suggest using Blank() instead of 0
Cummulative By Year = IF(max(Dates[Date])>Dates[Current Date], BLANK(), CALCULATE(SUM('Table'[Field]), DATESYTD(Dates[Date])))