Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
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
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 37 | |
| 37 | |
| 33 | |
| 32 | |
| 29 |
| User | Count |
|---|---|
| 130 | |
| 88 | |
| 82 | |
| 68 | |
| 64 |