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
anonymous_98
Resolver I
Resolver I

DAX comparison operations do not support comparing values of type Date with values of type Text

Error Message: 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.

 

can you please help me with the same?

1 ACCEPTED SOLUTION
anonymous_98
Resolver I
Resolver I

I have found the solution for this.

 

here is the piece of code in the DAX code which caused issue.

before fixing: 

 

        CALCULATETABLE(
            VALUES(Sales[Customer ID]),
            FILTER(
                ALL(Sales),
                Sales[Purchase Date] >= _DateBeforeNDays & Sales[Purchase Date] <= _EndOfMonthDate
            )
        )

 

 

After fixing: 

        CALCULATETABLE(
            VALUES(Sales[Customer ID]),
            FILTER(
                ALL(Sales),
                Sales[Purchase Date] >= _DateBeforeNDays && Sales[Purchase Date] <= _EndOfMonthDate
            )
        )

 why the error caused in the first place?

--> if you see in the first code, instead of using && operator I was just using & operator. and that was the only reason for the error. 

View solution in original post

7 REPLIES 7
Syndicate_Admin
Administrator
Administrator

Hi, switch does not evaluate all conditions

GLOOMY CREDIT =
SWITCH(
TRUE(),
[TOTAL DCLIENTES] =1,600000000,
[TOTAL DCLIENTES]= 2, 750000000,
[TOTAL CUSTOMERS]= 3, 700000000,
0
)
aztirma_1-1682629653625.png
TOTAL DCLIENTES =
DISTINCTCOUNT(cupocredito[DCLIENTE]).

If I do it with sum, I don't do it either.
TOTAL DCLIENTES =
SUM(cupocredito[DCLIENTE])

aztirma_2-1682630185164.png
Thank you

Thank you
Syndicate_Admin
Administrator
Administrator

Good day thanks!
Sure enough, what I did was assign a number to each letter (A, B, C) in a conditional column and it worked.
I made the formula with SWITCH, but it only evaluates the first correct condition, but the others are assigned the same result of the first condition. Please if you can guide me. Thank you

SWITCH(
TRUE(),
[TOTAL CUSTOMERS]=1 && [Days Difference]<=30, "5%",
[TOTAL CUSTOMERS]=2 && [Days Difference]<=60, "1%",
[TOTAL CUSTOMERS]=3 && [Days Difference]<=60, "3%",
"No discount"
)
aztirma_1-1682542059411.png






@Syndicate_Admin , pls add the TOTAL CUSTOMERS column to the grid, so that its easy to evaluate your SWITCH

Syndicate_Admin
Administrator
Administrator

Hello good day

This dax throws me the error "DAX comparison operations do not support interger comparison values with Text values.Consider using the VALUE or FORMAT function to convert one of the values.

Could you help me please?

Thank you

VALOR DPP =
IF(AND([TOTAL CUSTOMERS]="A",[TOTAL DAYS]<=30),0.05*[TOTAL INVOICES],
IF(AND([TOTAL CUSTOMERS]="B", [TOTAL DAYS]<=60),0.01*[TOTAL INVOICES],
IF(AND([TOTAL CUSTOMERS]="C", [TOTAL DAYS]<=60),0.05*[TOTAL INVOICES],

"No discount"
)))

@Syndicate_Admin in case TOTAL CUSTOMERS is a number then if you are comparing it with a String "A" which is wrong. also check the data type of TOTAL DAYS, it should be integer.

amitchandak
Super User
Super User

@anonymous_98 , Kudos to you

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
anonymous_98
Resolver I
Resolver I

I have found the solution for this.

 

here is the piece of code in the DAX code which caused issue.

before fixing: 

 

        CALCULATETABLE(
            VALUES(Sales[Customer ID]),
            FILTER(
                ALL(Sales),
                Sales[Purchase Date] >= _DateBeforeNDays & Sales[Purchase Date] <= _EndOfMonthDate
            )
        )

 

 

After fixing: 

        CALCULATETABLE(
            VALUES(Sales[Customer ID]),
            FILTER(
                ALL(Sales),
                Sales[Purchase Date] >= _DateBeforeNDays && Sales[Purchase Date] <= _EndOfMonthDate
            )
        )

 why the error caused in the first place?

--> if you see in the first code, instead of using && operator I was just using & operator. and that was the only reason for the error. 

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