Forum Discussion
Change button colour
jitpbi , You can use color measure, with field option. But I found an issue with slicer color : https://community.powerbi.com/t5/Issues/Field-Conditional-formatting-is-not-working-in-slicer/idi-p/1228974#M59165
Color sales = if(AVERAGE(Sales[Sales Amount])<170,"green","red")
Color Year = if(FIRSTNONBLANK(Table[Year],2014) <=2016,"lightgreen",if(FIRSTNONBLANK(Table[Year],2014)>2018,"red","yellow"))
Color = if(FIRSTNONBLANK(Table[Year],2014) <=2016 && AVERAGE(Sales[Sales Amount])<170
,"lightgreen",if(FIRSTNONBLANK(Table[Year],2014)>2018,"red","yellow"))
Color sales = if([Sales Today] -[sales yesterday]>0,"green","red")
color =
switch ( true(),
FIRSTNONBLANK(Table[commodity],"NA") ="commodity1" && sum(Table[Value]) >500,"lightgreen",
FIRSTNONBLANK(Table[commodity],"NA") ="commodity2" && sum(Table[Value]) >1000,"lightgreen",
/// Add more conditions
"red"
)
,
link how to use color measure
https://radacad.com/dax-and-conditional-formatting-better-together-find-the-biggest-and-smallest-numbers-in-the-column
https://docs.microsoft.com/en-us/power-bi/desktop-conditional-table-formatting#color-by-color-values
- jitpbi6 years agoPost Patron
Hi,
I have tried with the following measure but it's picking up the green colour only for each value:
Measure = SWITCH(TRUE(),FIRSTNONBLANK('Entity State'[State],"NA") = 0,"green",FIRSTNONBLANK('Entity State'[State],"NA") = 1,"orange",FIRSTNONBLANK('Entity State'[State],"NA") = 2,"yellow")Thanks,- Fowmy6 years agoSuper User
jitpbi
User Field Value in CF under fill color and assign the Measure below, Button Color Field can have actual color name or HEX Codes_Color = VAR _SELECTED = SELECTEDVALUE('Table'[BUTTON COLOR]) RETURN _SELECTEDIf you are satisfied with my answer, please mark it as a solution so others can easily find it.
Don't forget to give KUDOS to replies that help answer your questions
Subscribe to ExcelFort: Learn Power BI, Power Query and Excel
- jitpbi6 years agoPost Patron
Hi amitchandak ,
Thank you for the help.
I have tried the below measure but it still takes the first value only "#73B761"
Measure = SWITCH(TRUE(),FIRSTNONBLANK('Entity State'[State],"NA") = 0,"#73B761", FIRSTNONBLANK('Entity State'[State],"NA") = 1,"#F17925", FIRSTNONBLANK('Entity State'[State],"NA") = 2,"#D9B300").Please let me know if i am doing any mistake here. Also, the field in my dataset has three values 0,1 and 2.Thanks.