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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.