Forum Discussion
YASHASHRI
3 years agoHelper I
Color coding by using DAX
I would like to see the color coding same as below (dark color for current quarter or same quarter last year)
Hi,
Here is one way to do this:Measure 42 = var _currentQ = QUARTER(TODAY())var _year = YEAR(TODAY())var _date = MAX([Date])return
IF(QUARTER(_date)=_currentQ && OR(YEAR(_date)=YEAR(TODAY()),YEAR(_date)=YEAR(TODAY())-1),"Red","Blue")
Now replace the colors with the one you want (hex codes) and place the measure as conditional formatting like this:
End result:
I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!
My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/
2 Replies
- ValtteriNCommunity Champion
Hi,
Here is one way to do this:Measure 42 = var _currentQ = QUARTER(TODAY())var _year = YEAR(TODAY())var _date = MAX([Date])return
IF(QUARTER(_date)=_currentQ && OR(YEAR(_date)=YEAR(TODAY()),YEAR(_date)=YEAR(TODAY())-1),"Red","Blue")
Now replace the colors with the one you want (hex codes) and place the measure as conditional formatting like this:
End result:
I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!
My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/- YASHASHRIHelper I
Thanks for your help.
I also tried using only one condition i.e. of the quarter it also worked for me.