This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreDid you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now
Little Help here, Im using one Measure in a matrix table (CRR = Retention %) and looking at the 2022 CRR and 2021 CRR with Year in the column portion of my table. I want to use conditional formatting to highlight 2022 CRR % only, red = less than PY and green = higher than PY. I wrote a dax measure that I thought was going to do this but 2021 is showing up red and 2022 is showing up green and the logic is wrong. When I go to delete "red" from the DAX formula, 2022 is all green no matter if its less or greater than 2021.
Code
Table Output (with green and red):
Table Output (just green):
(SEE EITL JUST GREEN FOR ERROR)
The second table output would be correct if EITL 2022 would have shown up red.
Solved! Go to Solution.
@Anonymous Logic wise I would try something like:
Color Measure =
VAR _CurrentYear = YEAR(TODAY())
VAR _CYmeasure = [Measure]
VAR _PYmeasure = [PYmeasure] -- CALCULATE( [Measure] , DATEADD(Date[Date], -1, YEAR) )
RETURN
IF( YEAR( Date[Date] ) = _CurrentYear,
IF ( _CYmeasure > _PYmeasure, "Green", "Red")
)
Copying DAX from this post? Click here for a hack to quickly replace it with your own table names
Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C
I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com
@Anonymous Logic wise I would try something like:
Color Measure =
VAR _CurrentYear = YEAR(TODAY())
VAR _CYmeasure = [Measure]
VAR _PYmeasure = [PYmeasure] -- CALCULATE( [Measure] , DATEADD(Date[Date], -1, YEAR) )
RETURN
IF( YEAR( Date[Date] ) = _CurrentYear,
IF ( _CYmeasure > _PYmeasure, "Green", "Red")
)
Copying DAX from this post? Click here for a hack to quickly replace it with your own table names
Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C
I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com
@Anonymous Your screenshot is small, can you please paste the DAX code direct into a post here?
Copying DAX from this post? Click here for a hack to quickly replace it with your own table names
Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C
I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 36 | |
| 32 | |
| 31 | |
| 21 | |
| 15 |
| User | Count |
|---|---|
| 68 | |
| 57 | |
| 31 | |
| 29 | |
| 22 |