Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hello guys! I have a running total measure and I just can't seem to get the correct values. I tried different approaches I saw on the web. My running/cumulative total is giving the base measure as a result.
Here's my running total measure:
Cumulative Total Category CAB =
SUMX(
FILTER(ALLSELECTED('Cashflow A'[Date].[Month]),
SELECTEDVALUE('Cashflow A'[Date].[Month]) <= MAX('Cashflow A'[Date].[Month])),[Total CAB])
Here's the base measure:
Total CAB = [Total Collections Sum] - [Total Category AB]
Total Collections Sum =
CALCULATE(
[Sum Amount],
FILTER(ALL('Cashflow A'),
'Cashflow A'[Path L1] = "Collections" && 'Cashflow A'[Date].[MonthNo] = SELECTEDVALUE('Cashflow A'[Date].[MonthNo])))
Total Category AB =
(CALCULATE(
[Sum Amount],
FILTER(ALL('Cashflow A'),
'Cashflow A'[Path L1] = "Total Category A" && 'Cashflow A'[Date].[MonthNo] = SELECTEDVALUE('Cashflow A'[Date].[MonthNo])))) +
(CALCULATE(
[Sum Amount],
FILTER(ALL('Cashflow A'),
'Cashflow A'[Path L1] = "Total Category B" && 'Cashflow A'[Date].[MonthNo] = SELECTEDVALUE('Cashflow A'[Date].[MonthNo]))))
Solved! Go to Solution.
@ace512 hmm i recommend reading this: detailed breakdown of possibilities: https://www.daxpatterns.com/cumulative-total/
From what i can see:
- don't really need a SUMX for a cumulative total
- Filtering all but then passing in selected value as the comparison is redundant as you're just evaluating the current line and making sure it is like itself ,you'll see what I mean if you swap out the sum
Total Collections Sum =
CALCULATE(
SELECTEDVALUE('Cashflow A'[Date].[MonthNo]),
FILTER(ALL('Cashflow A'),
'Cashflow A'[Path L1] = "Collections" && 'Cashflow A'[Date].[MonthNo] = SELECTEDVALUE('Cashflow A'[Date].[MonthNo])))
If it's returning more than 1 value it will be blank, but I suspect in the visual you posted above it will just show the current month column
@ace512 hmm i recommend reading this: detailed breakdown of possibilities: https://www.daxpatterns.com/cumulative-total/
From what i can see:
- don't really need a SUMX for a cumulative total
- Filtering all but then passing in selected value as the comparison is redundant as you're just evaluating the current line and making sure it is like itself ,you'll see what I mean if you swap out the sum
Total Collections Sum =
CALCULATE(
SELECTEDVALUE('Cashflow A'[Date].[MonthNo]),
FILTER(ALL('Cashflow A'),
'Cashflow A'[Path L1] = "Collections" && 'Cashflow A'[Date].[MonthNo] = SELECTEDVALUE('Cashflow A'[Date].[MonthNo])))
If it's returning more than 1 value it will be blank, but I suspect in the visual you posted above it will just show the current month column
Awesome. Thanks for this!
User | Count |
---|---|
94 | |
86 | |
78 | |
69 | |
63 |
User | Count |
---|---|
113 | |
99 | |
97 | |
64 | |
59 |