Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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.
NAME | COUNT |
1 | 3822 |
2 | 2444 |
TOTAL | 6265 |
Many thanks in advance.
Solved! Go to Solution.
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)
Best Regards,
Jay
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.
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)
Best Regards,
Jay
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
)
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
107 | |
93 | |
77 | |
65 | |
53 |
User | Count |
---|---|
147 | |
106 | |
104 | |
87 | |
61 |