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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
czuniga
Helper III
Helper III

Dynamic Conditional Formatting

I'm tring to add conditional colors to columns based on what's less than/greater than a dynamic parameter value. Any ideas on how to do it? Adding a column with dynamic values seemed promising, but I came up short on being able to implement it. TIA. 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@czuniga 

You can create a dynamic color measure. In place of static values, you can replace with value from the slicer

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"))

 

Use fields option under conditional control and choose a measure like this. Refer :https://docs.microsoft.com/en-us/power-bi/desktop-conditional-table-formatting#color-by-color-values

 

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

View solution in original post

8 REPLIES 8
amitchandak
Super User
Super User

@czuniga 

You can create a dynamic color measure. In place of static values, you can replace with value from the slicer

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"))

 

Use fields option under conditional control and choose a measure like this. Refer :https://docs.microsoft.com/en-us/power-bi/desktop-conditional-table-formatting#color-by-color-values

 

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Worked perfectly. Thank you!

@czuniga , please mark the solution that worked for you.

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

I feel like this is really close. What do I do with that measure in the context of needing to change the colors of the colums in this image based on the selection of the highlighted parameter? 80-20.jpg

@czuniga , have created a measure or used rule. If used measure shared calculation. else share rules,

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
Pragati11
Super User
Super User

Hi @czuniga ,

 

It will be really useful to have some form of screesnhots to your query or a .pbix file.

Currently, it's hard to understand and answer your question.

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Hi Pragati, thanks for the response. I'm trying to conditionally format the colors of the these columns based on the selectio of the highlighted parameter. 80-20.jpg

nosaj03
Helper II
Helper II

@czuniga You can actually create a measure that does this. I actually had to do the same thing based on a rolling average. Check the links below

 

https://docs.microsoft.com/en-us/power-bi/desktop-conditional-table-formatting

 

https://www.blue-granite.com/blog/controlling-conditional-formatting-using-dax

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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