I'm trying to calculate the running total of a count using values from the previous date, and while my previous value calculation is correct, the running total isn't working properly. Instead of doing a running total, it's giving the same values as the previous value measure.
Sample of Data:
Here's the DAX that I've tried using - any help would be greatly appreciated!
Normal Values: DISTINCTCOUNTNOBLANK(Item A)
Previous Value #1: CALCULATE(Normal Values, TOPN(1, FILTER(ALLSELECTED(Table), Table[Date] < MAX(Table[Date])), Table[Date], DESC))
Previous Value #2: CALCULATE(Normal Values, FILTER(ALLSELECTED(Table), Table[DateRank] = (MAX(Table[DateRank]) - 1)
Running Total Attempt #1: CALCULATE(Previous Value, FILTER(ALL(Table), Table[Date] < MAX(Table[Date]))
Running Total Attempt #2: CALCULATE(Previous Value, FILTER(ALLSELECTED(Table), Table[Date] < MAX(Table[Date]))
Running Total Attempt #3: CALCULATE(Previous Value, FILTER(ALLSELECTED(Table[Date]), ISONORAFTER(Table[Date], MAX(Table[Date]), DESC)))
Running Total Attempt #4:
var PreviousDay1 = CALCULATE(Normal Values, TOPN(1, FILTER(ALLSELECTED(Table), Table[Date] < MAX(Table[Date])), Table[Date], DESC))
var RunningTotal = CALCULATE(PreviousDay1, FILTER(ALL(Table), Table[Date] < MAX(Table[Date]))
return
Running Total
Note: both Previous Value #1 and #2 give the same exact results and are working as expected, I just tried different calculations to see if the structure was the issue. There are also no filters placed on the workbook, so it's not an issue with filters or other charts being selected on the page.
I have also tried both Previous Value #1 and #2 in all of the four Running Total DAX calculations above, but none seem to work. That being said, if I substitute "Previous Values" for "Normal Values" in the calculations, they running total calculation works, so it appears that the issue is with the previous values DAX being nested inside of the running total DAX.