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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
romovaro
Responsive Resident
Responsive Resident

Formula multiples requirements return color Status

 

Hello

 

I have the table below:

 

romovaro_0-1738333208209.png

 

What I am trying to achieve is a formula where I can get all the requirements below and return colors:

 

RED

AMBER

GREEN

No countries under Imp

 

Criteria:

 

Unscheduled % up to 10% is GREEN/, >10% is AMBER and >25% RED 

HNS % up to 10% is GREEN/, >10% is AMBER and >25% RED 

Amber-Red up to 15% is GREEN, >15% is AMBER , >20% RED

 

And if countries_UI is blank, then No countries under Imp

 

 

ANy help is welcome

 

Thanks

 

1 ACCEPTED SOLUTION

I thought Countries_UI was not a measure. But, it is also a measure then you can just replace that line with this line:

ISBLANK([Countries_UI]),
 

Best Regards,
Muhammad Yousaf

 

If this post helps, please consider "Accept it as the solution" to help the other members find it more quickly.

 

LinkedIn

View solution in original post

7 REPLIES 7
muhammad_786_1
Super User
Super User

Hi @romovaro 

 

You can use this measure to get your desired output:

 

Color_Status = 
VAR UnscheduledStatus = 
    SWITCH(
        TRUE(),
        [Unscheduled%] <= 0.10, "Green",
        [Unscheduled%] > 0.10 && [Unscheduled%] <= 0.25, "Amber",
        [Unscheduled%] > 0.25, "Red"
    )

VAR HNSStatus = 
    SWITCH(
        TRUE(),
        [HNS%] <= 0.10, "Green",
        [HNS%] > 0.10 && [HNS%] <= 0.25, "Amber",
        [HNS%] > 0.25, "Red"
    )

VAR AmberRedStatus = 
    SWITCH(
        TRUE(),
        [Amber-Red] <= 0.15, "Green",
        [Amber-Red] > 0.15 && [Amber-Red] <= 0.20, "Amber",
        [Amber-Red] > 0.20, "Red"
    )

VAR FinalColor = 
    IF(
        ISBLANK(SELECTEDVALUE('Table'[Countries_UI])), 
        "No countries under Imp",
        IF(
            UnscheduledStatus = "Red" || HNSStatus = "Red" || AmberRedStatus = "Red", "Red",
            IF(
                UnscheduledStatus = "Amber" || HNSStatus = "Amber" || AmberRedStatus = "Amber", "Amber",
                "Green"
            )
        )
    )

RETURN FinalColor

 

Output:

muhammad_786_1_0-1738336925337.png

Best Regards,

Muhammad Yousaf

 

If this post helps, then please consider "Accept it as the solution" to help the other members find it more quickly.

 

LinkedIn

HI @muhammad_786_1 

Thanks. Looks good. I am having an issue with one of the measures:

 

 

 

romovaro_0-1738340656374.png

 

Tried using selectedmeasure but not working.

romovaro_1-1738341033047.png

 

 

I also created a column showing 0, 1 and tried to adapt to your formula but again...the last part is showing isses.

UI Countries Count = IF('PV Cel File'[Status]="under Implementation", "1", "0")
Countries UI =
CALCULATE(
    SUM('PV Cel File'[UI Countries Count]),
    ALLEXCEPT('PV Cel File','PV Cel File'[CID])
)
 
Could you help me, pls?

I thought Countries_UI was not a measure. But, it is also a measure then you can just replace that line with this line:

ISBLANK([Countries_UI]),
 

Best Regards,
Muhammad Yousaf

 

If this post helps, please consider "Accept it as the solution" to help the other members find it more quickly.

 

LinkedIn

@romovaro Were you looking for the word "Green", or formatting the actual cell with a green background? Please be specific about what you desire. You showed us nice input data. Can you show us sample desired results?




Did I answer your question? If so, mark my post as a solution. Also consider helping someone else in the forums!

Proud to be a Super User!





ToddChitt
Super User
Super User

Hello @romovaro 

That is fine. The Conditional Formatting logic is applied at the aggregation level (either a numeric field that is aggregated in the visual, or a measure) of the visual:

 

ToddChitt_0-1738334995017.png

 




Did I answer your question? If so, mark my post as a solution. Also consider helping someone else in the forums!

Proud to be a Super User!





ToddChitt
Super User
Super User

This sounds like a simple job for Conditional Formatting (Right-click on a field in the visual, and select Conditional Formatting. You get these options:

ToddChitt_0-1738334154272.png

 




Did I answer your question? If so, mark my post as a solution. Also consider helping someone else in the forums!

Proud to be a Super User!





hi Todd

 

Thanks for your answer. THe thing is that all the fields are measure.

data source is showing multiples rows for every customer and the table is summarizing all the data in one row x customer.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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