Forum Discussion
Conditional formatting based on another column
Anonymous were you able to achieve this?
"to compare previous month data to the recent month data, and highlight the recent month data in red or green depending on if it is higher or lower than the previous month"
I am looking to do the same but dont have solution yet.
Thanks
Hi Anonymous
I had a similar requirement to you and I have found a solution.
Create a new measure using an IF statement to return 1 or 0 if column A is bigger than column B. In my example I first used a sumx measure to produce column totals to use in my table.
new measure = IF ([columnA]>[columnB], 1, 0)
If you put this new measure in to your column you will see a 1 or 0 depending on if the column value is bigger or not. While you don't need to leave this in your final version, it is helpful to check the measure worked as intended.
You can now set a conditional format to change the column format dependent on the results of your new measure. In my example I wanted to see if the actual value is higher than budget, colour red if yes and colour green if no. I set the conditional formatting as per my screenshot. Select the new measure in the "Based on filed" option, and select your desired colours.
I hope this helps!