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
alpeytongreene
Helper II
Helper II

Multiple Condition Conditional Formats Matrix Table

I am working on benchmarking data visualizations. 

 

I need to format a row total in a matrix table to show a yellow or red value based on the percentage and which size facility it is. I have the categories for the locations and their names  in the table as well. 

Facility Sizes - Values

>200 Beds-  17.1%- 21.09% (Yellow), 21.1% and greater (Red)

200-349 Beds- 19.8% - 29.79%(Yellow) 29.8% and greater (Red)

350- 500 Beds- 16.9%- 26.89% (Yellow), 26.9% and greater (Red)

>500 Beds- 15.9%- 25.89 (Yellow), 25.9% and greater (Red)

 

Anything less than those I would need as white. 

 

Examples

Hospital A - >200 Beds has a turnover of 17% they would be white, but when they have a few more leave it becomes 20.15% so at that time it would become yellow. 

Example of Location and PercentageExample of Location and Percentage

 

BUT 

 

If location B has a bed size of 350-500 and has 16% it would be white, but when they have several more terms they would go to 18% and be yellow as well. 

1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@alpeytongreene try this then

 

Color Measure = 
VAR __bedsCount = MAX ( Table[Bed Count Column] )
VAR __turnover = [Percentage Measure]
RETURN
SWITCH ( TRUE(),
   __bedsCount "> 500 Beds", IF ( __turnover > 0.259, "Red", IF ( __turnover > 0.159, "Yellow" ) ),
   __bedsCount "350-500 Beds", IF ( __turnover > 0.269, "Red", IF ( __turnover > 0.169, "Yellow" ) ),
   __bedsCount "<200 Beds", IF ( __turnover > 0.298, "Red", IF ( __turnover > 0.198, "Yellow" ) ),
    IF ( __turnover > 0.211, "Red", IF ( __turnover > 0.171, "Yellow" ) )
)

 

make sure value exactly matches with the values in your data.

 

Follow us on LinkedIn and YouTube.gif to our YouTube channel

 

Learn about conditional formatting at Microsoft Reactor

My latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

8 REPLIES 8
parry2k
Super User
Super User

@alpeytongreene try this then

 

Color Measure = 
VAR __bedsCount = MAX ( Table[Bed Count Column] )
VAR __turnover = [Percentage Measure]
RETURN
SWITCH ( TRUE(),
   __bedsCount "> 500 Beds", IF ( __turnover > 0.259, "Red", IF ( __turnover > 0.159, "Yellow" ) ),
   __bedsCount "350-500 Beds", IF ( __turnover > 0.269, "Red", IF ( __turnover > 0.169, "Yellow" ) ),
   __bedsCount "<200 Beds", IF ( __turnover > 0.298, "Red", IF ( __turnover > 0.198, "Yellow" ) ),
    IF ( __turnover > 0.211, "Red", IF ( __turnover > 0.171, "Yellow" ) )
)

 

make sure value exactly matches with the values in your data.

 

Follow us on LinkedIn and YouTube.gif to our YouTube channel

 

Learn about conditional formatting at Microsoft Reactor

My latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

alpeytongreene_0-1647968507452.png

Hello, I am finally getting to circle back- I am receiving an error message on the hospital size information. I have replaces the quotation marks since BI does not like them. It says I have an incorrect syntax for the dax. 

 

parry2k
Super User
Super User

@alpeytongreene I assume it is a number column, change the measure as below:

Color Measure = 
VAR __bedsCount = SUM ( Table[Bed Count Column] )
VAR __turnover = [Percentage Measure]
RETURN
SWITCH ( TRUE(),
   __bedsCount > 500, IF ( __turnover > 0.259, "Red", IF ( __turnover > 0.159, "Yellow" ) ),
   __bedsCount > 349, IF ( __turnover > 0.269, "Red", IF ( __turnover > 0.169, "Yellow" ) ),
   __bedsCount > 199, IF ( __turnover > 0.298, "Red", IF ( __turnover > 0.198, "Yellow" ) ),
    IF ( __turnover > 0.211, "Red", IF ( __turnover > 0.171, "Yellow" ) )
)

Follow us on LinkedIn and subscribe to our YouTube channel

 

Learn about conditional formatting at Microsoft Reactor

My latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

It is just a category, not a number. So the hospital/bed size is a category for a turnover. So there are the

>200 Beds 

and 

350-500 Beds

 

Example 2.PNG

parry2k
Super User
Super User

what do you refer to hospital size, bed count?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Yes, the bed count would be the same as hospital size. Apologies for that. 

parry2k
Super User
Super User

@alpeytongreene assuming these are measures, bed count and % and use following measure to get the color and then use it in the conditional formatting, tweak the formula as per your need

 

Color Measure = 
VAR __bedsCount = [Bed Count Measure]
VAR __turnover = [Percentage Measure]
RETURN
SWITCH ( TRUE(),
   __bedsCount > 500, IF ( __turnover > 0.259, "Red", IF ( __turnover > 0.159, "Yellow" ) ),
   __bedsCount > 349, IF ( __turnover > 0.269, "Red", IF ( __turnover > 0.169, "Yellow" ) ),
   __bedsCount > 199, IF ( __turnover > 0.298, "Red", IF ( __turnover > 0.198, "Yellow" ) ),
    IF ( __turnover > 0.211, "Red", IF ( __turnover > 0.171, "Yellow" ) )
)

 

Follow us on LinkedIn

 

Learn about conditional formatting at Microsoft Reactor

My latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

The Hospital size is not a measure, it is a conditional column category. 

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.