cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
dobregon Member
Member

conditional formatting for multiples kpis by one field only

Hi,

 

I'm checking now the new posibility of conditional formating by field https://powerbi.microsoft.com/es-es/blog/power-bi-desktop-august-2018-feature-summary/#conditionalFo... and I'm having some issues that I hope you guys can help me.

As an example, I have 3 different KPIs (PR1 KPI, PR2 KPI and PR3 KPI) that need to be related to the same condition of colors

  • If value < 0.95 --> Red
  • If 0.95< value < 1 --> Yellow
  • If value > 1 --> Green

I have used the same example as the url for this and i have written this code:

Color KPIs = SWITCH(
            TRUE()
                ,table[PR1 KPI]<0.9,"#FD625E"
                ,table[PR1 KPI]<0.99,"#F2C80F"
                ,table[PR1 KPI]>=1,"#41BF37"
                ,table[PR2 KPI]<0.9,"#FD625E"
                ,table[PR2 KPI]<0.99,"#F2C80F"
                ,table[PR2 KPI]>=1,"#41BF37"
                ,table[PR3 KPI]<0.9,"#FD625E"
                ,table[PR3 KPI]<0.99,"#F2C80F"
                ,table[PR3 KPI]>=1,"#41BF37"
                ,"#FFFFFF"
                )


Then I have created the visual table matrix with the 3 KPIs and then i have applied the conditional formating as the example in the url
0d592fe1-dee6-453e-ba44-4af9501a2f21

 

The problem that I have is that the background color not take for each KPI the related color, it os something strange like the system takes the 1st color rule for each row and put the color for the next KPIs, example
if i have PR1 KPI = 94%, PR2 KPI = 98% and PR3 KPI 105% the system put 3 backrounds in red due to the first KPI in the code is the PR1 KPI and it is red in this case insted of put Red for PR1 KPI , Yellow in PR2 KPI and Green in PR3 KPI. Do you know the reason?

Is it necessary to create a Color KPI measure for each KPI that i have? it will be crazy....

 

Is there any possibility to modified the code of the measure Color KPI in order to can be applied in any measurement only depending the result value?

something like 

  • If value < 0.95 --> Red
  • If 0.95< value < 1 --> Yellow
  • If value > 1 --> Green

But not related to any measurement, and then can we apllied for any measuremente that i want to aplly the conditional formating based on this Color KPI?

 

Thanks in advance, regards!

2 REPLIES 2
Community Support Team
Community Support Team

Re: conditional formatting for multiples kpis by one field only

Hi @dobregon,

 

If you create the Color KPI only for PR1 KPI, will it work as expected?

 

Color KPIs = SWITCH(
            TRUE()
                ,table[PR1 KPI]<0.9,"#FD625E"
                ,table[PR1 KPI]<0.99,"#F2C80F"
                ,table[PR1 KPI]>=1,"#41BF37"
                ,"#FFFFFF"
                )

If it is convenient, could you share some data sample which could reprofuce your scenario so that we could help further on it?

 

Best Regards,

Cherry

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

Re: conditional formatting for multiples kpis by one field only

Hi @v-piga-msft

Yes, if i create the Color KPI only for PR1 KPI it works fine, but in reality i have more than 20 measurements KPI that need to have the same conditional formating. So, if i need to create 20 Color KPI measurements.... it will be crazy. For that i'm asking if i can create a color KPI measurement that apply for whatever measurement only checking if the results of the measuremetns <90, >95 and >1

 

Regards