Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Albatross810
Regular Visitor

Create a status based on instances of a value in a column

Hello!

 

I'm looking to use a single visual (possibly KPI?) to display a traffic light system representing overall status. So for example:

 

Inventory
Status
LaptopPass
KeyboardPass

Watch

Fail

 

Based on the table above, the visual should display Red for example, since the column contains "Fail".

Inventory
Status
LaptopPass
KeyboardPass

 

Based on the second table above, where the user has filtered to exclude the item "watch", the visual should now display Green, since all statuses displayed are "Pass".

 

InventoryStatus
MouseUntested
ChairPass

 

And finally, based on the table above, the visual should display yellow since there is an instance of Untested in the column.

 

Could someone please help me out with this? Any pointers would be really appreciated, thanks so much in advance!

 

1 ACCEPTED SOLUTION
AdaKAda
Helper I
Helper I

Or you can even do this and just diplay the measure on a card! 

 

Colour =
IF (
CALCULATE (
COUNT ( 'InventoryTable'[Status] ),
FILTER ( 'InventoryTable', 'InventoryTable'[Status] = "Fail" )
) > 0,
"🔴",
IF (
CALCULATE (
COUNT ( 'InventoryTable'[Status] ),
FILTER ( 'InventoryTable', 'InventoryTable'[Status] = "Untested" )
) > 0,
"🟡",
"🟢"
)
)

 

😀

View solution in original post

4 REPLIES 4
AdaKAda
Helper I
Helper I

Or you can even do this and just diplay the measure on a card! 

 

Colour =
IF (
CALCULATE (
COUNT ( 'InventoryTable'[Status] ),
FILTER ( 'InventoryTable', 'InventoryTable'[Status] = "Fail" )
) > 0,
"🔴",
IF (
CALCULATE (
COUNT ( 'InventoryTable'[Status] ),
FILTER ( 'InventoryTable', 'InventoryTable'[Status] = "Untested" )
) > 0,
"🟡",
"🟢"
)
)

 

😀

Awesome, this worked excellently. Thanks very much for your help!

AdaKAda
Helper I
Helper I

If you create a new measure sort of like this: 

 

Colour =
IF (
CALCULATE (
COUNT ( 'InventoryTable'[Status] ),
FILTER ( 'InventoryTable', 'InventoryTable'[Status] = "Fail" )
) > 0,
"Red",
IF (
CALCULATE (
COUNT ( 'InventoryTable'[Status] ),
FILTER ( 'InventoryTable', 'InventoryTable'[Status] = "Untested" )
) > 0,
"Yellow",
"Green"
)
)

 

you can then use the measure value directly in any visual as its colour, backgound colour, border etc etc. 

HotChilli
Super User
Super User

You can use conditional formatting for this sort of thing.

Add a column to the table to represent the appropriate colour for each Status

, for example, Pass = Green then set the conditional formatting up.

Here's the help page https://learn.microsoft.com/en-us/power-bi/create-reports/desktop-conditional-table-formatting#color... 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.