Forum Discussion
heidibb
Helper IV
7 years agoRunning Total Over Six Term Timeframe
Hello, I am trying to build a calculation that will give me a running total over the list six terms as of each term. My data is set up as follows: What I would ...
- 7 years ago
Hi heidibb ,
You can try to create measure or column like DAX below.
Measure1= Var A6= CALCULATE(SUMX(Success,[Measure]),FILTER(ALLSELECTED(Success), Success[TermAxis] <=MAX(Success[TermAxis])-5)) Var B5= CALCULATE(SUMX(Success,[Measure]),FILTER(ALLSELECTED(Success), Success[TermAxis] <=MAX(Success[TermAxis])-4)) Return SWITCH(MAX(Success[Code]),"AA",A6, "BB",B5) Column1= Var A6= CALCULATE(SUMX(Success,[Measure]),FILTER(ALLSELECTED(Success), Success[TermAxis] <=EARLIER(Success[TermAxis])-5)) Var B5= CALCULATE(SUMX(Success,[Measure]),FILTER(ALLSELECTED(Success), Success[TermAxis] <=EARLIER(Success[TermAxis])-4)) Return SWITCH(Success[Code],"AA",A6, "BB",B5)
Best Regards,
Amy
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
artemus
Microsoft Employee
7 years agoI think it would be easier/more clear if you used a calculated column instsead:
VAR current = [Axis] RETURN CALCULATE(SUM(Table), FILTER(Table, [Axis] > current -6 && [axis] <= current))
heidibb
Helper IV
7 years agoThank you. Still having a little trouble with this. I used a calculated column with this version of your suggestion:
Rolling = CALCULATE(SUM(Success[TotalEnrollments]), FILTER(Success, [TermAxis] > Success[TermAxis] -6 && [TermAxis] <= Success[TermAxis]))
I'm getting the same value on every row, which is the TOTAL of the "TotalEnrollments" column for the whole table. I just want to total the last term axis rows as of each term axis as I mentioned above.
What am i missing?