Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi!
I want a column that uses one calculation on each row and subtotal row, but a different calculation on the total row.
Example from Contoso sample data set:
In the Total row in the right hand column, I want to show the totals of the percentages at Continent level -- in this case 57.23+57.33+57.50 = 172.06. (I know it's not a realistic example, but it matches something I'm trying to do with real data.)
The [GM pct] variable is just showing Gross Margin as a % of Sales:
I've got this far with the formula for my total:
I know that the IF(HASONEVALUE()) part is working. But I can't find the syntax to sum the values of [GM pct].
Note that [GM pct] is a MEASURE not a column, so I can't use SUM. The visual is summarising a lot of rows in the fact table, and contains a lot of other logic in measures that I don't want to have to recreate by building a new table.
Thanks for any help 😀
Solved! Go to Solution.
Hi @Grellow
please try
GM pct total =
SUMX (
SUMMARIZE (
Sales,
Geography[ContinentName],
Product[ProductName],
'Date'[Year]
),
[GM pct]
)
Hi @Grellow
Please use
GM pct total =
SUMX ( VALUES ( Geography[ContinentName] ), [GM pct] )
Hi @tamerj1
Thanks *SO* much for your reply, that worked perfectly!
Unfortunately I now have a more complicated version of the same puzzle.
Your formula is in the blue cells, and gives exactly what I wanted.
But I now need a second calculation with a different formula, for the red column.
The calculation I have so far is this one:
I am getting the right results in cells A, B, C — summing up the values at Product.Category level. So, for example, cell B is the sum of the calculations for all the Categories within Europe. That’s what I need.
But in the Grand Total row I also need a sum of A+B+C, which here should be 10.3438.
I can’t get my head around what I would need for that …
Huge thanks again for any help 😀
Hi @Grellow
please try
GM pct total =
SUMX (
SUMMARIZE (
Sales,
Geography[ContinentName],
Product[ProductName],
'Date'[Year]
),
[GM pct]
)
I'm speechless. Thank you so much 😀.
(I took out the last dimension from the SUMMARIZE to make it exactly what I needed, but I can probably use your formula as well anyway!)
I guess a shorter version of my question is:
Can you manipulate the values of MEASURES at different total levels in a visualisation?
I know you can do it to COLUMN values, with SUM and SUMX.
But I’m not sure that DAX has any functions that will allow me to manipulate a MEASURE in this way.
Thanks for any comments 😀
hi @Grellow
try like:
Hi @FreemanZ . Thanks a lot for trying to help! Your formula returns the same thing as mine -- 57.41%. I've added the definition of [GM pct] into my first post, so you can see what it's doing.
I think I need my second measure to be summing the values at subtotal level ... somehow! But I don't know how to do that. Thanks again 😀
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
10 | |
9 | |
8 | |
8 | |
8 |
User | Count |
---|---|
13 | |
12 | |
11 | |
10 | |
8 |