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!View all the Fabric Data Days sessions on demand. View schedule
Hi there,
As in the first picture you can see that I have 3 columns. What I want to achieve here is the exact solution as picture second. Now I will explain.
As you can see there is a column named as "Quarter", which contains 2 values-Q1 and Q2. I want to total the sales column values according to the Quarter Category. Same as it is happening in the 2nd Picture. I want to do this, to calculate the margin afterwords.
BUT HERE IS A TWIST:
I know how to do this, in M code and Power Query. But I want the solution, If we want to create this kind of column as a new measure. I can't figure out the solution for this case.
Thanks and regards.
Solved! Go to Solution.
@Birinder I think you want:
Sub-Total Each Category Measure =
VAR __Quarter = MAX('Table'[Quarter])
RETURN
SUMX(FILTER(ALL('Table'),[Quarter]=__Quarter),[Sales])
Margin Measure =
[Sub-Total Each Category Measure] - MAX('Table'[Sales])
Hi there,
Thanks for the reply.
I want to ask you, Will this work if All the three columns ; "Quarter", "Model" and "Sales" are from 3 seperate tables, and are connected via relationship.
If Yes, then Inplace of "table" in code given by you, What am I supposed to enter.
Thanks and Regards
@Birinder I think you want:
Sub-Total Each Category Measure =
VAR __Quarter = MAX('Table'[Quarter])
RETURN
SUMX(FILTER(ALL('Table'),[Quarter]=__Quarter),[Sales])
Margin Measure =
[Sub-Total Each Category Measure] - MAX('Table'[Sales])
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!