Forum Discussion
Anonymous
3 years agoNot applicable
COLOR BOX FOR LEGEND THAT SHOW %
Do anyone know how to show the percentage based on the data with specific color box like the photo?
Anonymous
3 years agoNot applicable
Hi Anonymous ,
Accoridng to your statement, I suggest you to try conditonal formatting.
For reference: Apply conditional table formatting in Power BI - Power BI | Microsoft Learn
Here I create a sample to have a test.
Measure:
Percentage =
VAR _Value =
CALCULATE ( SUM ( 'Table'[Value] ) )
VAR _Total =
CALCULATE ( SUM ( 'Table'[Value] ), ALL ( 'Table' ) )
RETURN
DIVIDE ( _Value, _Total )Color =
VAR _RANK = RANKX(ALL('Table'),[Percentage],,DESC,Dense)
RETURN
SWITCH(_RANK,1,"Green",2,"Yellow","Red")
Format your visual > Cell elements > Series [Percentage]>Background
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
3 years agoNot applicable
May be i need to clarify something. The green color not meaning the largest percentage. The color must be in this order not matter the percenatge is, which mean it could be 1% for the green color and 98% for the red color.