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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

DATE/VALUE error with IF & OR statement

Hi everyone,

 

I have an IF & OR statement te syntax is below and I am getting the following 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."

 

Syntax

Have students increased in the period KS2 cohort = FORMAT(IF([Date of student enrollment ]=BLANK()  ||  [Date of student enrollment]="NULL" ||  {Date of student enrollment ]="-"   ||  [Date of student enrollment] || [Date of student enrollment]="na","No",
    IF([Date of student enrollment ])>=[Date of student outreach],"Yes","No")),"")

 

Even with trying to use Format I am getting an error, thank you in advance for your help

 

Regards,

 

P

1 ACCEPTED SOLUTION

@Anonymous Please try this...

 

Result = IF(IFERROR(SEARCH("/",Test59StrDate[Enrollment],4),0)>0,IF(VALUE(FORMAT(Test59StrDate[Enrollment],"Short Date"))>=Test59StrDate[Outreach],"Yes","No"),"No")

image.png





Did I answer your question? Mark my post as a solution!

Proud to be a PBI Community Champion




View solution in original post

5 REPLIES 5
petrovnikitamai
Resolver V
Resolver V

i'm not sure but try this

new column = 
IF([Date of student enrollment ]=BLANK()  ||  
    [Date of student enrollment]="NULL" ||  
    [Date of student enrollment ]="-"   ||  
    [Date of student enrollment] || 
    [Date of student enrollment]="na","No",
IF(DATEVALUE([Date of student enrollment ])>=DATEVALUE([Date of student outreach]),"Yes","No"))

 

Anonymous
Not applicable

Unfortunately, that still came up with an error
PattemManohar
Community Champion
Community Champion

@Anonymous As per the expression you have posted - I can understand that if "DateOfStudentEnrollment" > "DateOfStudentOutReach" then "Yes" otherwise "No". But there are blank values and other text data types in "DateOfStudentEnrollment" you can use that as Date Comparision with other Date field i.e. "DateOfStudentOutReach". That's the reason for your error. You need make those fields of same datatype (in this case it will be string). 





Did I answer your question? Mark my post as a solution!

Proud to be a PBI Community Champion




Anonymous
Not applicable

Changing the two columns to text give me incorrect vales when (student enrollment >= date of outreach, "yes", "no" and keeping them both as dates still gives me the Value/format error...:(

@Anonymous Please try this...

 

Result = IF(IFERROR(SEARCH("/",Test59StrDate[Enrollment],4),0)>0,IF(VALUE(FORMAT(Test59StrDate[Enrollment],"Short Date"))>=Test59StrDate[Outreach],"Yes","No"),"No")

image.png





Did I answer your question? Mark my post as a solution!

Proud to be a PBI Community Champion




Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors