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
Sumeesh
Regular Visitor

Conditional Formatting (icons or color change) based upon particular values in row and column

Hello Buddies,

I am stuck with one problem. Let me explain to you with my scenario.

Below is the data which I need to import to my Power Bi dashboard in Table Visualization:-

 

ParametersLocation 1Location 2
pH78
Turbidity4060

 

For the indication purpose, I need icon or colour change in the number to depend upon below conditions:-

 

pH for Location 1  (less than 6 in Red, between 6 to 7 in Orange & greater than 7 in Green) & for Location 2 (less than 7 in Red, between 7 to 8 in Orange & greater than 8 in Green)

 

Turbidity for Location 1  (less than 50 in Red, between 50 to 60 in Orange & greater than 60 in Green) & for Location 2 (less than 60 in Red, between 60 to 70 in Orange & greater than 70 in Green)

 

As of now, I can see conditional formatting respective to one full column or row only. Not for the respective row value or position. Waiting for the solution.

 

Thanks and Regards,

S

1 ACCEPTED SOLUTION
v-easonf-msft
Community Support
Community Support

Hi , @Sumeesh 

Try steps as below:

step1.create a color measure as below:

 

Color Location1 =
VAR a =
    CALCULATE (
        SUM ( 'Table'[Location1] ),
        FILTER ( 'Table', 'Table'[Parameter] = "pH" )
    )
VAR b =
    CALCULATE (
        SUM ( 'Table'[Location1] ),
        FILTER ( 'Table', 'Table'[Parameter] = "Turbidity" )
    )
VAR c =
    SWITCH (
        MAX ( 'Table'[Parameter] ),
        "pH", IF ( a <= 6, "#FF0000", IF ( a <= 7, "#FFA500", "#00FF00" ) ),
        "Turbidity", IF ( b <= 50, "#FF0000", IF ( b <= 60, "#FFA500", "#00FF00" ) )
    )
RETURN
    c

 

 

step2.And apply it to conditional formatting ( location1)

104.png

101.png

 

step3. And do the same steps to apply it to  column  location2

103.png

Here is a demo.

Pbix attached

 

Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
v-easonf-msft
Community Support
Community Support

Hi , @Sumeesh 

Could you please tell me whether your problem has been solved?
If it is,  please mark the helpful replies or add your reply as Answered to close this thread.

Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

v-easonf-msft
Community Support
Community Support

Hi , @Sumeesh 

Try steps as below:

step1.create a color measure as below:

 

Color Location1 =
VAR a =
    CALCULATE (
        SUM ( 'Table'[Location1] ),
        FILTER ( 'Table', 'Table'[Parameter] = "pH" )
    )
VAR b =
    CALCULATE (
        SUM ( 'Table'[Location1] ),
        FILTER ( 'Table', 'Table'[Parameter] = "Turbidity" )
    )
VAR c =
    SWITCH (
        MAX ( 'Table'[Parameter] ),
        "pH", IF ( a <= 6, "#FF0000", IF ( a <= 7, "#FFA500", "#00FF00" ) ),
        "Turbidity", IF ( b <= 50, "#FF0000", IF ( b <= 60, "#FFA500", "#00FF00" ) )
    )
RETURN
    c

 

 

step2.And apply it to conditional formatting ( location1)

104.png

101.png

 

step3. And do the same steps to apply it to  column  location2

103.png

Here is a demo.

Pbix attached

 

Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks for the reply.

But i am unable to select Colour Location1 in Based on filed drop down (Background colour - Location1) in condtional formatting section Step 2.

 

Please refer the snapshot.  cant select '"olor Raw water" from the dropdowncant select '"olor Raw water" from the dropdownLet me know if you need powerbi file from my side for detail view.

 

Thanks and Regards,

Sumeesh

 

Hi,  @Sumeesh 

It is  likely that there are some problems with    measure.

Can you show me the formula of your measure and your current  table  visualization.

 

Best Regards,
Community Support Team _ Eason

amitchandak
Super User
Super User

@Sumeesh ,Refer if this can help :https://docs.microsoft.com/en-us/power-bi/desktop-conditional-table-formatting

 

Check by Rule and by Value.

By value you can also create a measure like

Color Date = if(FIRSTNONBLANK('Date'[date],TODAY()) <today(),"lightgreen","red")
Color sales = if(AVERAGE(Sales[Sales Amount])<170,"green","red")
Color Year = if(FIRSTNONBLANK('Date'[Year],2014) <=2016,"lightgreen",if(FIRSTNONBLANK('Date'[Year],2014)>2018,"red","yellow"))

 

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.