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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
HI_IM_THIBBY
Helper I
Helper I

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.

HI_IM_THIBBY
Helper I
Helper I

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.