Forum Discussion
Cumulative Sum With Slicer
- Anonymous9 years ago
Of course!
mattbrice is right.
In order to get YTD using ALL you need to use this:
YTDSales = CALCULATE([Sales],FILTER(ALL('Business Date'),'Business Date'[Date]<MAX('Business Date'[Date])&&'Business Date'[Year]=YEAR(MAX('Business Date'[Date]))))
or just use this staightforward formula:
YTDSales = TOTALYTD([Sales],'Business Date'[Date])
And make sure you use Date column from your 'Business Date' table in slicer
Michael
This should work:
YTDSales = TOTALYTD([Sales],CalendarTable[Date])
Also, make sure that you use your CalendarTable Month column in your slicer (NOT the Month from the Fact table)
Michael
Hello Michael,
I have the same problem but with different structure.
I have two tables:
Extraction table
And a date table
I want to calculate a Cumulative Sum of the business values of the pirate tickets according to the start date column.
I have a slicer that contains the sprint ID.
When the sprint ID is selected in the slicer, I'd like the abcissa axis of the graph to display all the days between the start and end of the sprint included, and the curve to represent the data.
Here's the formula I use, which unfortunately doesn't add up the data.
The formula just shows me the data per day.
I'd like to accumulate this data per day.
RunningTotalePirate =
Var Sprintstart = calculate(FIRSTDATE('Extraction_fin_sprint'[DébutSprint]), ALLSELECTED ('Extraction_fin_sprint'))
Var Length = 20
Return
If (Max(TestCalendar[Date]) = Sprintstart , 0,
If (Max(TestCalendar[Date]) >= Sprintstart && Max(TestCalendar[Date])<= Sprintstart + Length,
0 + Calculate(sum(Extraction_fin_sprint[Business Value]),
Filter(allselected(Extraction_fin_sprint),
Extraction_fin_sprint[Prévu_Pirate]= "pirate"),
Extraction_fin_sprint[Start date] <= max(TestCalendar[Date])
&& Extraction_fin_sprint[Date départ] >= min(TestCalendrier[Date])
)
))