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
Anonymous
Not applicable

Conditional Formatting

HI, I want to apply conditional formatting on a column in Table Visual. 
Problem Statement : I have a Balance column. I want to format it in such a way that if the value is less than 0, then the background should be Red. If the value is greater than 0, then the value should be Green. 

Thanks in advance!! 

 

1 ACCEPTED SOLUTION
hansei
Helper V
Helper V

This measure will not color balance = 0

Color = 
    var _sum = CALCULATE( SUM( Table1[Balance] ) )
    return SWITCH( true,
        _sum < 0, "Red",
        _sum > 0, "Green"
    )

Then apply to table column

hansei_0-1655816767978.png

Used this for input

Table.FromRows( { { "A", 1 }, { "A", -2 }, { "B", 3 }, { "C", 0 } }, type table [Name=text, Balance=Int64.Type] )

View solution in original post

5 REPLIES 5
speedramps
Super User
Super User

Polite reminder.

Remeber we are unpaid volunteers.

Click the thumbs up and accept as solution button. 

One question per ticket please. If you need to extend your request then please raise a new ticket.

You will get a quicker response and each volunteer solver will get the kudos they deserve. Thank you !

hansei
Helper V
Helper V

This measure will not color balance = 0

Color = 
    var _sum = CALCULATE( SUM( Table1[Balance] ) )
    return SWITCH( true,
        _sum < 0, "Red",
        _sum > 0, "Green"
    )

Then apply to table column

hansei_0-1655816767978.png

Used this for input

Table.FromRows( { { "A", 1 }, { "A", -2 }, { "B", 3 }, { "C", 0 } }, type table [Name=text, Balance=Int64.Type] )
Anonymous
Not applicable

Thank you so much for your solution. 

speedramps
Super User
Super User

Create this dax measure

 

BalanceRAG =
IF( SUM(tanlename[Balance]) >= "Green","Red")

 

Click on the Balance field in your visual right hand side fields well, conditional formating, background colour, based on Fields, Field = BalanceRAG

 

Please click thumbs up and accept as solution

 

 

 

 

Anonymous
Not applicable

Thank you so much for the solution @speedramps !!

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.