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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Justgoogleit
New Member

Percentage Donuts

Hi, could someone help me please?

I am trying to create a percentage donut .

My table look as per below..but I need the calculation to work as follows... 2444/3822 giving me two sections one with 63.94% for 2 and one with 36.06 for 1. 

NAMECOUNT
13822
22444
TOTAL6265

Many thanks in advance.

1 ACCEPTED SOLUTION
v-jayw-msft
Community Support
Community Support

Hi @Justgoogleit ,

 

Please check the formula.

Measure = 
var _value = CALCULATE(SUM('Table'[COUNT]),FILTER(ALLSELECTED('Table'),'Table'[NAME]<>SELECTEDVALUE('Table'[NAME])))
var _count = CALCULATE(SUM('Table'[COUNT]),FILTER(ALLSELECTED('Table'),'Table'[NAME]=SELECTEDVALUE('Table'[NAME])))
return
IF(_value<_count,1-(_value/_count),_count/_value)

vjaywmsft_0-1648819665993.png

 

Best Regards,

Jay

 

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

View solution in original post

3 REPLIES 3
Numerro
Advocate I
Advocate I

If you're looking for formatting design help, we built some basic tips for building donut charts and have example Power BI donut charts for inspiration.

v-jayw-msft
Community Support
Community Support

Hi @Justgoogleit ,

 

Please check the formula.

Measure = 
var _value = CALCULATE(SUM('Table'[COUNT]),FILTER(ALLSELECTED('Table'),'Table'[NAME]<>SELECTEDVALUE('Table'[NAME])))
var _count = CALCULATE(SUM('Table'[COUNT]),FILTER(ALLSELECTED('Table'),'Table'[NAME]=SELECTEDVALUE('Table'[NAME])))
return
IF(_value<_count,1-(_value/_count),_count/_value)

vjaywmsft_0-1648819665993.png

 

Best Regards,

Jay

 

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
AlexisOlson
Super User
Super User

So 2 is 64% of 1 and 1 is 36% of what?

 

I guess you could make it work like this:

Pct = 
VAR _Total = CALCULATE ( SUM ( Table1[Count] ), Table1[Name] = 1 )
VAR _2 = CALCULATE ( SUM ( Table1[Count] ), Table1[Name] = 2 )
VAR _1 = _Total - _2
RETURN
    SWITCH (
        SELECTEDVALUE ( Table1[Name] ),
        1, _1,
        2, _2
    )

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.