Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
Hi,
I have to dynamically change the colour of a button based on the field's value. The filed has 3 different values 0,1 & 2, please refer the below example:
Field Values | Button Color |
0 | Green |
1 | Orange |
2 | Yellow |
I had tried through conditional formatting, in the fill color option, but it takes only aggregated value. Please help to achieve this.
Thanks
Hi @jitpbi ,
For button have a look at this
https://www.youtube.com/watch?v=TVjlf_ucQ6I
https://www.youtube.com/watch?v=oWVMFUle8QU
https://community.powerbi.com/t5/Desktop/Customized-Conditional-Formatting-Using-DAX/td-p/733277
Regards,
Harsh Nathani
HI @jitpbi,
You can create a table visual with your records and configure these fields to summarize mode 'do not summarize'.
Then you can apply conditional formatting on 'button color' fields with raw fields values instead of aggregate values.
Regards,
Xiaoxin Sheng
Hi, I have tried after configuring the field to summarize mode 'do not summarize' and used conditional formatting in "Fill" option of button but it's not working.
My Field has three values : 0,1,2 and i need three different colours for these values.
Thanks
@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/...
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-num...
https://docs.microsoft.com/en-us/power-bi/desktop-conditional-table-formatting#color-by-color-values
Hi @amitchandak ,
Thank you for the help.
I have tried the below measure but it still takes the first value only "#73B761"
Hi,
I have tried with the following measure but it's picking up the green colour only for each value:
@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
_SELECTED
If 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
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
User | Count |
---|---|
86 | |
82 | |
68 | |
64 | |
55 |
User | Count |
---|---|
123 | |
100 | |
90 | |
83 | |
66 |