Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
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 | |
13 | |
12 | |
11 | |
11 |
User | Count |
---|---|
19 | |
14 | |
14 | |
11 | |
9 |