cancel
Showing results for 
Search instead for 
Did you mean: 
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
May 2023 update

Power BI May 2023 Update

Find out more about the May 2023 update.

Submit your Data Story

Data Stories Gallery

Share your Data Story with the Community in the Data Stories Gallery.

Top Solution Authors