Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi everyone.
I've got a matrix which shows the margin for each month of 2018, 2019, 2020, 2021:
Since I want to use the conditional formatting, I would like to compare the margins from one month to another in order to apply different colours to the cells:
Margins are calculated using a different measure for each year (only the year value changes):
Solved! Go to Solution.
Hi @mtrevisiol ,
You could refer to this blog to create a measure of the previous month.
https://www.sqlbi.com/articles/comparing-with-previous-selected-time-period-in-dax/
Then create a condition measure to set the background.
condition = IF(Sales[Sales PM]>Sales[Sales Amount],"red","green")
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @mtrevisiol ,
You could refer to this blog to create a measure of the previous month.
https://www.sqlbi.com/articles/comparing-with-previous-selected-time-period-in-dax/
Then create a condition measure to set the background.
condition = IF(Sales[Sales PM]>Sales[Sales Amount],"red","green")
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Author another measure to calculate MoM margin difference to be used in the "conditional formatting" functionality.
| Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! |
DAX is simple, but NOT EASY! |
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 59 | |
| 45 | |
| 42 | |
| 23 | |
| 17 |
| User | Count |
|---|---|
| 190 | |
| 122 | |
| 96 | |
| 66 | |
| 47 |