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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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