cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
yuhkao
Microsoft
Microsoft

Conditional formatting with measure on criteria

Hi Expert

 

Based on this question, I got deeper equation on data and would like to apply conditional format with color code on different threshold.

 

example:

                            Jan-2020  Feb-2020  Mar-2020  Apr-2020

commodity1         data         data          data          data

commodity2         data         data          data          data

commodity3         data         data          data          data

 

Data threhold1 =  initial goal + 1 *2.57* SQRT(initial goal*(1- initial goal)/base)

Data threhold2 =  initial goal + 2 *2.57* SQRT(initial goal*(1- initial goal)/base)

Data threhold3 =  initial goal + 3 *2.57* SQRT(initial goal*(1- initial goal)/base)

*initial goal is different upon commodity

*base is differnt upon month usage or commodity

 

With data threhold1 to 3, would like to apply different color code, like green, yellow, red

thanks 

1 REPLY 1
amitchandak
Super User
Super User

@yuhkao , You can create a measure like this. And used it with Field option in conditional formatting

Color  = if(FIRSTNONBLANK(Table[Year],2014) <=2016 && AVERAGE(Sales[Sales Amount])<170 
,"lightgreen",if(FIRSTNONBLANK(Table[Year],2014)>2018,"red","yellow"))
Color sales = if([Sales Today] -[sales yesterday]>0,"green","red")

color =
switch ( true(),
FIRSTNONBLANK(Table[commodity],"NA") ="commodity1" && sum(Table[Value]) >500,"lightgreen",
FIRSTNONBLANK(Table[commodity],"NA") ="commodity2" && sum(Table[Value]) >1000,"lightgreen",
/// Add more conditions
"red"
)

 

https://radacad.com/dax-and-conditional-formatting-better-together-find-the-biggest-and-smallest-num...
https://docs.microsoft.com/en-us/power-bi/desktop-conditional-table-formatting#color-by-color-values
https://community.powerbi.com/t5/Desktop/FORMAT-icon-set-for-use-in-a-data-card/td-p/811692

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!! !!
Dashboard of My Blogs !! Connect on Linkedin
Want To Learn Power BI
Learn Power BI Beginners !! Advance Power BI Concepts !! Power BI For Tableau User !! Learn Power BI in Hindi !!
Proud to be a Super User!

Helpful resources

Announcements
2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.

Power BI December 2021 Update_carousel 768x460.jpg

Check it Out!

Click here to read more about the December 2021 Updates!

Jan 2022 Dev Camp 768x460 copy.png

Power BI Dev Camp- January 27th, 2022

Mark your calendars and join us for our next Power BI Dev Camp!

Top Solution Authors