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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
manu385
Regular Visitor

DAX, nested if function with not supporting dates and text comparison error

hello there, 
I'm trying to add a new column with nested if functions but im getting this error : DAX comparison operations do not support comparing values of type Date with values of type Text. Consider using the VALUE or FORMAT function to convert one of the values. 
I verified each of my column used in the function and they are all either dates or Whole number format, is it because its 2 different format? and if so how would I change the date format to whole numbers to be able to have the number of days between 2 dates when my conditons are met.

Here is my function : 


delai CSR = IF(
InvestigationCompteur[RMBECrééLe]<> "",
TRUNC(
InvestigationCompteur[RMBECrééLe]-InvestigationCompteur[DateIntitiation],0),
IF(
InvestigationCompteur[MT20 requis (INT)]="2",
TRUNC(
InvestigationCompteur[DateÉtat]-InvestigationCompteur[DateIntitiation],0),
IF(
InvestigationCompteur[MT20DateRV]="",
TRUNC(
NOW()-InvestigationCompteur[DateIntitiation],0),
TRUNC(
InvestigationCompteur[MT20DateRV]-InvestigationCompteur[DateIntitiation],0
))))
 
 
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hello,

 

I'm thinking that this part of your switch is where the error could be:

IF(
InvestigationCompteur[MT20DateRV]="",
TRUNC(
NOW()-InvestigationCompteur[DateIntitiation],0),

If InvestigationCompteur[MT20DateRV] is a DATE value, you're trying to see if it is equal to "", which is a string value. If you're trying to say, "if [MT20DateRV] is null do this", try setting it = to BLANK() like below:

IF(
InvestigationCompteur[MT20DateRV] = BLANK(),
TRUNC(
NOW()-InvestigationCompteur[DateIntitiation],0),




View solution in original post

2 REPLIES 2
dax
Community Support
Community Support

Hi @manu385 ,

It seems to be type problem, you said that type is whole value or date, I think you need to change expression like below

InvestigationCompteur[RMBECrééLe]<> blank()
InvestigationCompteur[MT20 requis (INT)]=2

The "" represent text, you need to modify it to see whteher it work or not.

 

Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hello,

 

I'm thinking that this part of your switch is where the error could be:

IF(
InvestigationCompteur[MT20DateRV]="",
TRUNC(
NOW()-InvestigationCompteur[DateIntitiation],0),

If InvestigationCompteur[MT20DateRV] is a DATE value, you're trying to see if it is equal to "", which is a string value. If you're trying to say, "if [MT20DateRV] is null do this", try setting it = to BLANK() like below:

IF(
InvestigationCompteur[MT20DateRV] = BLANK(),
TRUNC(
NOW()-InvestigationCompteur[DateIntitiation],0),




Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors