The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
I have found the following 4 ways to calculate a running total as a measure. What are the pros and cons of each method?
Solved! Go to Solution.
There isn't any difference between those methods, the performance speeds are logically the same since they all just comparing dates. Method 1 and Method 2 are the same, Method 1 just stores the MaxDate into a variable then use it in the return expression.
What's important is the different between using All(table) and Allselected(table). If you want to using filter or slicer on the the running total measure, you would need to using allselected() instead of just ALL(). For example:
Item Running Total2 =
CALCULATE(
SUM('Table'[Item]),
FILTER(
ALLSELECTED('Table'[Date]),
'Table'[Date] <= MAX('Table'[Date])))
There isn't any difference between those methods, the performance speeds are logically the same since they all just comparing dates. Method 1 and Method 2 are the same, Method 1 just stores the MaxDate into a variable then use it in the return expression.
What's important is the different between using All(table) and Allselected(table). If you want to using filter or slicer on the the running total measure, you would need to using allselected() instead of just ALL(). For example:
Item Running Total2 =
CALCULATE(
SUM('Table'[Item]),
FILTER(
ALLSELECTED('Table'[Date]),
'Table'[Date] <= MAX('Table'[Date])))
User | Count |
---|---|
16 | |
8 | |
6 | |
6 | |
5 |
User | Count |
---|---|
23 | |
13 | |
13 | |
8 | |
8 |