Compare Dates and Show font in red based on result


I wanted to compare two dates and show font in red when the result is true.
Here’s what I am trying to achieve.
Can some help me understand where i am going wrong


[Measures].[Issue Date IRL 2 Entry]
CASE WHEN DateCompare(
[Measures].[Actual IRL1 Exit Date] > [Measures].[Target IRL1 Exit Date])
“<span style='color:red>”

Hi @Tanu,

You are on the right track. There are a few adjustments to make this work.

  1. Use function DateCompare() to compare two dates. There are more details and example of this function:

  2. Date that you would like to show in the red color should be between <span ...> and </span>.

  3. Make sure to set measure formatting to Markdown (

The updated formula might look like this:

CASE WHEN --compare two dates
    [Measures].[Actual IRL1 Exit Date],
    [Measures].[Target IRL1 Exit Date]
  ) > 0
THEN --if Actual date > Target date
  "<span style='color:red'>" || 
  Format([Measures].[Issue Date IRL 2 Entry],'dd mmm yyyy')
  || "</span>" 

Check out tips and tricks on measure formatting for more examples: