Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
Hi all,
I am requested to create a colored block by our client like following: the condition is if number of column a = number of column b,then green , otherwaise red.
How can I do that? Really need help.
Thank you in advance!
Branko
Hi @babyjb1979
You haven't provided a lot of detail so I don't know exactly how you want this implemented.
But if you take this sample data (see file above)
and create a measure using this DAX. It checks whether the slicer has anything selected, then sets a color accordingly
Block Color = IF(ISFILTERED('DataTable'[Thing]), IF(SELECTEDVALUE('DataTable'[a]) = SELECTEDVALUE('DataTable'[b]), "#0F0", "#F00"), "#FFF")
I'm using a card visual to act as the box with the color. You could other things like a shape, or you could use a cell in a table.
Create a conditional formatting rule for the box that sets the color for the background and the text in the box. If both are the same it looks like there's no text, just a colored box.
Select the card visual then in Visualizations -> Format -> Visual -> Callout value click the fx button to create the conditional formatting rule
Repeat those steps for the background of the card visual. You'll find this in General -> Effects -> Background -> fx button
Heres' the conditional formatting rule. It's the same for the background and the text in the card
Use the slicer to select diffwerent 'Things', so for values that are the same
and not the same
If you need it implemented differently, please post sample data and a clear, detailed explanation of what it is you need.
Regards
Phil
Proud to be a Super User!
Hi @babyjb1979 ,
That calls for conditional formatting on a shape. Here's a video tutorial
Proud to be a Super User!
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
User | Count |
---|---|
119 | |
72 | |
72 | |
57 | |
50 |
User | Count |
---|---|
167 | |
83 | |
68 | |
66 | |
55 |