Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Glaeran
Frequent Visitor

% of Total from Ratio/division measure

Hey there.

 

I have following data structure:

 

Bez tytułu.png

 

 

 

 

 

 

Measures A and B are comming from data source as simple Sum([Col_A]) or Sum([Col_B]).

A/B is created by DIVIDE([A],[B]).

 

What I'm trying to achieve is get % of Total based on [A/B]. I tried to reapply similar formula that I'm using for [% of Total A] :  DIVIDE([A], CALCULATE([A],ALLSELECTED(Table))). But naturally it's not working properly as DAX divides everything by "15,0" instead of "152,2" (sum of individual values in A/B column).

 

How to properly write DAX formula for that scenario?

5 REPLIES 5
v-lili6-msft
Community Support
Community Support

HI, @Glaeran 

This looks like a measure totals problem. Very common. See this post about it
https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376

Also, this Quick Measure, Measure Totals, The Final Word should get you what you need:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907

 

For your case, add new measure based on [A/B]

Measure = VAR _TABLE=SUMMARIZE('Table','Table'[Type],"_A/B",[A/B]) RETURN
SUMX(_TABLE,[_A/B])

Result:

4.JPG

 

Best Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-lili6-msft  thank you. This is almost what I'm looking for.

My main issue now is that this measure shouldn't be dependant on "Type" as this can get changed by the end-users dynamically [measure is supposed to land in SSAS cube]. Any ideas here?

You can't create measure on SSAS from PBI. It's not supported.
You can import pbix as new tabular model. It's all. 

@saykasku  I don't want to create measure in PowerBI.

Entire calculation will be placed in SSAS which will be connected to PBI/Excel/Other tools. And user will have a chance on which level he wants to see the data. Therefore I believe that hardcoding reference column won't work in my scenario as this can change easily and wrong values will be displayed.

saykasku
Resolver I
Resolver I

In this case u are dividing by 1 381 882 099,6.

 

If u want to divide by 155,2 u need to:

 

a/b =
CALCULATE(
SUMX(
ALL(DDIM_DATE[MONTH_NR_IN_YEAR]);
DIVIDE([A];[B])
);
FILTER(DDIM_DATE; DDIM_DATE[YEAR_NR] = max(DDIM_DATE[YEAR_NR]))
)
 
and its done.
 
 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.