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

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

Hi everyone,

 

I've created a Calculation Group with two items: MTD and YTD.

When using this Calculation Group in a report, I get the error that I'm trying to compare an integer with a text.

 

Here's my DAX for both items:

MTD:

CALCULATE (
SELECTEDMEASURE(),
FILTER(
Dim_Date,
Dim_Date[Posting Period] = MAX(Dim_Date[Posting Period])
)
)

 

YTD:

CALCULATE (
SELECTEDMEASURE(),
FILTER(
Dim_Date,
Dim_Date[Posting Period] <= MAX(Dim_Date[Posting Period])
)
)

 

Posting Period is set to Whole Number in the dimension table.

I've tried using CONVERT and VALUE, but I still get the same error.

2 REPLIES 2
v-janeyg-msft
Community Support
Community Support

Hi, @Anonymous 

 

I saw that you used 'SELECTEDMEASURE()' function in your dax code. I think perhaps the problem lies here. Because your formula has no syntax error. Why not write the measure directly in the report so that we can find the problem quickly.  If you want to solve the problem, you need to provide more information and share it.

 

Best Regards

Janey Guo

 

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

 

amitchandak
Super User
Super User

@Anonymous , This error can come if the Posting Period is text. has <= operation might create a problem. But overall seems fine.

Can you share a sample pbix after removing sensitive data.

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.