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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Calculate ratio

Hi,

 

I need to calculate the ratio of some fields. I have the following data, this is the structure of the data. 

IDNumbersDateHour
1205-13-202010:00
1105-13-202011:00
2305-13-202010:00
3305-13-202010:00
3105-13-202011:00

 

I need to create a new column or measure, don't know whats better to use, to calculate the ratio.

I need the follow numbers

IDRatio
130%
230%
340%

 

I can use a measure with SUM('table1'[numbers]) and then use this in a card to show the total numbers. I can also click here in the desktop version to "show percent of grand total" which will give me 100%. When I to this in a table I get the correct numbers as show above.

 

But I want to show an average of these ratio's and I just can't manage to do this with measure. Because I need the total numbers of a day of all ID together and divide this with the total numbers of the ID itself. In this way you get the ratio of each ID.

 

I hope someone can help me with this. 

6 REPLIES 6
v-chuncz-msft
Community Support
Community Support

@Anonymous 

 

You may use the measure below.

Measure =
DIVIDE (
    AVERAGEX ( VALUES ( Table1[ID] ), CALCULATE ( SUM ( Table1[Numbers] ) ) ),
    CALCULATE ( SUM ( Table1[Numbers] ), ALLSELECTED ( Table1[ID] ) )
)

 

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

Thank you both @v-chuncz-msft and @az38 . Both of the solutions works with a measure. 

 

Is this formula also possible to use as an extra column instead of a measure? 

az38
Community Champion
Community Champion

@Anonymous 

yes, it should be fine


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
Greg_Deckler
Community Champion
Community Champion

You could a default SUM aggregation on Number and use "Show as...Percent of grand total".

 

@Anonymous 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

@Greg_Deckler Thank you for your reply.

I know I can use a percent of grand total, but I want a measure that's calculation the average of all the ratio's of all ID's. And I can't do that with the "percent of grand total" function. Hope you understand my question, sorry for my garbage English.

az38
Community Champion
Community Champion

Hi @Anonymous 

try a measure

Measure = 
DIVIDE(
CALCULATE(SUM(Table[Numbers]), ALLEXCEPT(Table, Table[ID]) ),
CALCULATE(SUM(Table[Numbers]), ALL(Table) )
)

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.