Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hi Community,
I was going through the DAX formula for cumulative/running total in this link:
https://community.powerbi.com/t5/Desktop/Cumulative-Total/td-p/43115
Running Total MEASURE =
CALCULATE (
SUM ( 'All Web Site Data (2)'[UniquePageviews] ),
FILTER (
ALL ( 'All Web Site Data (2)' ),
'All Web Site Data (2)'[Date] <= MAX ( 'All Web Site Data (2)'[Date] )
)
)
I couldn't understand one thing in the above formula. How does the MAX bring the value that is present in the current filter context. I understand that using ALL clears any filters and the FILTER iterates through the table for each row. But one thing I don't get is how the MAX bring the value that is currently present in the filter context.
Please help with this explanation!
Solved! Go to Solution.
Running Total MEASURE =
CALCULATE (
SUM ( 'All Web Site Data (2)'[UniquePageviews] ),
FILTER (
ALL ( 'All Web Site Data (2)' ), //Clear filter in table
'All Web Site Data (2)'[Date] <= MAX ( 'All Web Site Data (2)'[Date] ) //Filter date is less than or equal to the date of the current row.
)
)
Sum the values, use the all function to clear the filter in the table, and calculate the sum of dates less than or equal to the current row in each row.
Please see if this article clarifies things.
Filter Arguments in CALCULATE - SQLBI
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Hi Pat,
The article is for normal '=' filters which I am able to understand , but this filter with MAX alone is where I am stuck. I couldn't get how MAX value brings the current row's value. I am hoping to understand this so that I can better understand FILTER within CALCUALTE.
Running Total MEASURE =
CALCULATE (
SUM ( 'All Web Site Data (2)'[UniquePageviews] ),
FILTER (
ALL ( 'All Web Site Data (2)' ), //Clear filter in table
'All Web Site Data (2)'[Date] <= MAX ( 'All Web Site Data (2)'[Date] ) //Filter date is less than or equal to the date of the current row.
)
)
Sum the values, use the all function to clear the filter in the table, and calculate the sum of dates less than or equal to the current row in each row.
User | Count |
---|---|
117 | |
75 | |
61 | |
50 | |
44 |
User | Count |
---|---|
174 | |
125 | |
60 | |
60 | |
57 |