Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago

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

  • 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.

  • v-janeyg-msft's avatar
    v-janeyg-msft
    Icon for Community Support rankCommunity 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.