Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi all,
I have table:
| Key | Quantity | Measure | Measure2 |
| AA | 5 | 0 | 0 |
| AA | 12 | 1 | 30 (12+8+10) |
| AA | 8 | 1 | 30 (12+8+10) |
| AA | 10 | 1 | 30 (12+8+10) |
| BB | 3 | 1 | 3 |
How is it possible to get subtotal based on Measure, so that in Measure2 I have subtotal of Key AA and not summing where measure is 0.
Thank you all for support so far, this is such a great community!
Solved! Go to Solution.
Hi @MrMP ,
The method of nesting measures may cause calculation logic errors. I suggest replacing the measure with a calculate column, and then creating a measure to get the sum value corresponding to column 1.
M =
CALCULATE (
SUM ( 'Table'[Quantity] ),
FILTER ( ALL ( 'Table' ), 'Table'[calculated column] = 1 )
)
If the problem is still not resolved, please provide detailed error information . Let me know immediately, looking forward to your reply.
Best Regards,
Henry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @MrMP ,
The method of nesting measures may cause calculation logic errors. I suggest replacing the measure with a calculate column, and then creating a measure to get the sum value corresponding to column 1.
M =
CALCULATE (
SUM ( 'Table'[Quantity] ),
FILTER ( ALL ( 'Table' ), 'Table'[calculated column] = 1 )
)
If the problem is still not resolved, please provide detailed error information . Let me know immediately, looking forward to your reply.
Best Regards,
Henry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Please try this measure expression. Replace Qty and Measure1 with your actual table and measure names.
Exclude Zeros =
VAR vSummary =
CALCULATETABLE (
ADDCOLUMNS (
SUMMARIZE ( Qty, Qty[Key], Qty[Quantity] ),
"cMeasure1", [Measure1]
),
ALLEXCEPT ( Qty, Qty[Key] )
)
VAR vResult =
SUMX ( FILTER ( vSummary, [cMeasure1] > 0 ), Qty[Quantity] )
RETURN
IF ( [Measure1] = 0, 0, vResult )
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Thank you for the solution. But for some reason I couldnt use it since I ran out of memory.
Please confirm you used it as a measure and not a column. Also, can you share more about your model (tables, # rows, relationships, etc.) and the expression you tried?
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Yes I did use it as measure. Well the whole pbix is really complex. Probably has 100+ measures, # of rows is ~40k, 80 pages. There are only few relationships and they are just small master tables.
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 103 | |
| 80 | |
| 62 | |
| 50 | |
| 45 |