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

Conditional formating of one column based on another column

I have a 2 columns which is Snapshot Hours & Charged Hours, Both columns are in the same table Report1

I want to apply coloring in such a way that, the Snapshot Hours should be red in color if it is less than 80% of Charged hours. (I want to apply this to a card in Power BI)

How do I apply that logic ?..

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

Hi, @akashpadmakumar 

According to your description, I can clearly understand your requirement, I think you can create a measure to be used for the field formatting of the card chart like this:

This is my test data:

v-robertq-msft_0-1623120226995.png

Color =

var _snapshot=SUM('Table'[Snapshot Hours])

var _charged=SUM('Table'[Charged Hours])*0.8

return

IF(_snapshot<_charged,"Red","Green")

 

Then you can click on the card chart and apply the field formatting like this:

v-robertq-msft_1-1623120227004.png

v-robertq-msft_2-1623120227007.png

 

And you can get what you want, like this:

v-robertq-msft_3-1623120227010.png

 

You can download my test pbix file below

Thank you very much!

 

Best Regards,

Community Support Team _Robert Qin

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

2 REPLIES 2
v-robertq-msft
Community Support
Community Support

Hi, @akashpadmakumar 

According to your description, I can clearly understand your requirement, I think you can create a measure to be used for the field formatting of the card chart like this:

This is my test data:

v-robertq-msft_0-1623120226995.png

Color =

var _snapshot=SUM('Table'[Snapshot Hours])

var _charged=SUM('Table'[Charged Hours])*0.8

return

IF(_snapshot<_charged,"Red","Green")

 

Then you can click on the card chart and apply the field formatting like this:

v-robertq-msft_1-1623120227004.png

v-robertq-msft_2-1623120227007.png

 

And you can get what you want, like this:

v-robertq-msft_3-1623120227010.png

 

You can download my test pbix file below

Thank you very much!

 

Best Regards,

Community Support Team _Robert Qin

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

selimovd
Super User
Super User

Hey @akashpadmakumar ,

 

you can do that with another measure:

Color =
IF(
    SUM( myTable[Snapshot Hours] ) < SUM( myTable[Charged hours] ) * 0.8,
    "Red"
)

 

And this measure you can use for the conditional formatting.

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

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.

Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.