Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I would like to calculate a subtotal using dax (not using the subtotal feature of matrix visual)
Sample data:
Client | Shop | Sales |
A | 1 | 100 |
A | 2 | 200 |
B | 3 | 400 |
B | 4 | 500 |
Desired outcome:
I want a measure that can calculate Client total for the displayed Shop without adding the client field itself to the visual
Shop | Client Total |
1 | 300 |
2 | 300 |
3 | 900 |
4 | 900 |
Best I could come up with was
CALCULATE(SUM('Table1'[Sales]); ALL('Table1'[Shop]))
but it just gives me a repeating 1200 across all shops as it should unless I add client field to the table.
How can I add filter context for the client into the measure if its not part of a visual?
Solved! Go to Solution.
@Credo Please try this as a "New Measure"
Test107 = CALCULATE(SUM(Test107Measure[Sales]),FILTER(ALL(Test107Measure),Test107Measure[Client]=SELECTEDVALUE(Test107Measure[Client])))
Proud to be a PBI Community Champion
Add as measure
TotVal = CALCULATE(SUM(Table1[Sales]),ALLEXCEPT(Table1,Table1[Client]))
@Credo Please try this as a "New Measure"
Test107 = CALCULATE(SUM(Test107Measure[Sales]),FILTER(ALL(Test107Measure),Test107Measure[Client]=SELECTEDVALUE(Test107Measure[Client])))
Proud to be a PBI Community Champion
Thanks a lot
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
100 | |
80 | |
64 | |
58 |
User | Count |
---|---|
148 | |
111 | |
93 | |
84 | |
66 |