Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
colettb
Helper I
Helper I

Formula Error Using Date Variables - DAX error does not make sense to me

Hello all,

 

I am trying to create a flag of 1 or 0 based on the timing of 2 date columns in my table, but I am getting the error message "DAX comparison does not support comparing values  of type Date with values of type Text".  Both of my date variables are stored in power BI as type Date, so I'm unsure where my error is?  

 

Here is my formula:

Flag = IF(ISBLANK('Metrics'[Date1]) & 'Metrics'[Date2]<(today()-60),1,0)
 
What I'm trying to accomplish is if Date1 is not null and Date2 is less than today-60 days, then the flag is 1, otherwise 0.
 
Any help is really appreciated!
1 ACCEPTED SOLUTION
Cookistador
Super User
Super User

hi @colettb 

 

The error happens because a single ampersand (&) is used for joining text strings (concatenation). Power BI is trying to concatenate a string with a date comparison, causing a type conflict.

To fix this, you need to make two changes:

  1. Use the double ampersand (&&), which is the logical AND operator for combining conditions.
  2. To check if the date is not null, wrap your ISBLANK() check in the NOT() function.

 

Flag =
IF(
NOT(ISBLANK('Metrics'[Date1])) && 'Metrics'[Date2] < (TODAY() - 60),
1,
0
)

View solution in original post

2 REPLIES 2
colettb
Helper I
Helper I

Thank you @Cookistador!  That worked, I was totally looking at the wrong part of the formula.  

Cookistador
Super User
Super User

hi @colettb 

 

The error happens because a single ampersand (&) is used for joining text strings (concatenation). Power BI is trying to concatenate a string with a date comparison, causing a type conflict.

To fix this, you need to make two changes:

  1. Use the double ampersand (&&), which is the logical AND operator for combining conditions.
  2. To check if the date is not null, wrap your ISBLANK() check in the NOT() function.

 

Flag =
IF(
NOT(ISBLANK('Metrics'[Date1])) && 'Metrics'[Date2] < (TODAY() - 60),
1,
0
)

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.