cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
VegarOyfoss
Helper I
Helper I

Different conditional formatting depending on date

Hi Awesome people

 

I am wondering if it is possible to have different values for conditional formatting depending on date?

 

I have a report showing SLA of incoming calls. Until February 2020 the SLA has always been 90/20, meaning we should answer 90% of all calls within 20 seconds.
Since March 2020 however the SLA was lowered to 80/20.

 

So I am trying to figure out if there is any way to format a matrix or table if as an example, on January 2020 we had 89% result it would show a red number/background, while in March the same 89% would show green number/background

 

So this would be correct for February

february.png

 

While if I chose March all ASA numbers above 80% should be showns as green

march.png

 

1 ACCEPTED SOLUTION

Hi @VegarOyfoss ,

 

Modify your measure as below:

 

 

Color = if(SELECTEDVALUE('Calendar'[MonthYear]) <="February 2020" && AVERAGEX('calls',Calls[ASA])<0.8
,"red",if(SELECTEDVALUE('Calendar'[MonthYear])>="March 2020","lightgreen","yellow"))

 

 

Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!

View solution in original post

4 REPLIES 4
v-kelly-msft
Community Support
Community Support

Hi @VegarOyfoss

 

Is your issue solved?If it is solved ,can you mark the reply as answered to close it?

 

Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!
amitchandak
Super User
Super User

@VegarOyfoss , Create a color measure like this using Date, measures

 

Color = if(FIRSTNONBLANK('Date'[Year],2014) <=2016 && AVERAGE(Sales[Sales Amount])<170
,"lightgreen",if(FIRSTNONBLANK('Date'[Year],2014)>2018,"red","yellow"))

 

Then use the same in conditional formatting under advance control, Choose field and this measure

Refer: https://docs.microsoft.com/en-us/power-bi/desktop-conditional-table-formatting#color-by-color-values



Power BI Features || Datamarts: https://youtu.be/8tskWsJTEpg || Field Parameters : https://youtu.be/lqF3Wa1FllE?t=70
Time Intelligence Decoded : https://youtu.be/aU2aKbnHuWs&t=145s
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!
Dashboard of My Blogs !! Connect on Linkedin !! Subscribe to my youtube Channel !!
Want To Learn Power BI | Beginners !! Advance Concepts !! Power BI For Tableau User !!

@amitchandak 
I am trying to icorporate this to my model. The ASA is calculated with a meassure as below:

ASA = DIVIDE(Calls[SUM <20],Calls[SUM Accepts],1) and is modelled as %
 
In my Calendar table I have a column for MonthYear modelled as MMMM/YYYY i might be able to use
 
But I am not fully understanding the whole of you DAX. what does the 2014 in ('Date'[Year],2014) relate to for you?
 
Color = if(FIRSTNONBLANK('Calendar'[MonthYear]) <="February 2020" && AVERAGEX('calls',Calls[ASA])<0.8
,"red","yellow",if(FIRSTNONBLANK('Calendar'[MonthYear])>="March 2020","lightgreen"))
 
BUt this gives me an error stating Too few arguments passed to the first NONOBLANK  function, which I suspect is the 2014 in your example.

Hi @VegarOyfoss ,

 

Modify your measure as below:

 

 

Color = if(SELECTEDVALUE('Calendar'[MonthYear]) <="February 2020" && AVERAGEX('calls',Calls[ASA])<0.8
,"red",if(SELECTEDVALUE('Calendar'[MonthYear])>="March 2020","lightgreen","yellow"))

 

 

Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!

Helpful resources

Announcements
August 2022 update 768x460.jpg

Check it Out!

Click here to learn more about the August 2022 updates!

August 1 episode 9_no_dates 768x460.jpg

The Power BI Community Show

Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Top Solution Authors
Top Kudoed Authors