Forum Discussion
Running Total DAX Calculation returning incorrect result
Hello,
I am new to PowerBi and would like to add a Running Total with two filters for Country and Registered Month included, to my Dashboard.
Number_of_Districts is to be incremented, and I want to display the chart after the trends filtered by Registered Month and Country, like so:
I have used the line chart, and created a new measure for the value field, with the following DAX code:
Running Total = CALCULATE (
SUM ( 'Number_of_People_to_Districts'[Number of Districts] ),
FILTER (
ALL ( 'Number_of_People_to_Districts' ),
'Number_of_People_to_Districts'[Country] <= MAX('Number_of_People_to_Districts'[Country])
&&
'Number_of_People_to_Districts'[Registered Month] <= MAX ( 'Number_of_People_to_Districts'[Registered Month] )
)
)
Unfortunately, when I compared the result with a calculation in Tableau, there was a discrepancy. The returning results are incorrect, but I have not found the error yet.
Thanks & BR
Anonymous
you need to change the <= to = for the country part:Running Total = CALCULATE (
SUM ( 'Number_of_People_to_Districts'[Number of Districts] ),
FILTER (
ALL ( 'Number_of_People_to_Districts' ),
'Number_of_People_to_Districts'[Country] = MAX('Number_of_People_to_Districts'[Country])
&&
'Number_of_People_to_Districts'[Registered Month] <= MAX ( 'Number_of_People_to_Districts'[Registered Month] )
)
)
2 Replies
- SpartaBICommunity Champion
Anonymous
you need to change the <= to = for the country part:Running Total = CALCULATE (
SUM ( 'Number_of_People_to_Districts'[Number of Districts] ),
FILTER (
ALL ( 'Number_of_People_to_Districts' ),
'Number_of_People_to_Districts'[Country] = MAX('Number_of_People_to_Districts'[Country])
&&
'Number_of_People_to_Districts'[Registered Month] <= MAX ( 'Number_of_People_to_Districts'[Registered Month] )
)
)
- AnonymousNot applicable
Thanks a lot!