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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Anonymous
Not applicable

Error: Comparison operations don't support comparing values type Text with Values of Type Number

Hi, 

 

I'm new to DAX and need some help, I'm creating a measure in a tabular cube in SSAS. I need to retreive the LastYearLastWeek data from x column:

 

LastYearLastWeek:= CALCULATE([x], FILTER(ALL(Time), Time[WeekNumber] = SELECTEDVALUE(Time[WeekNumber]) -1 && Time[Year] = SELECTEDVALUE(Time[Year])-1))

 

But I get this error in the syntax: comparison operations don't support comparing values type Text with Values of Type Number. Considering using VALUE or FORMAT functions to convert one of the values. 

 

Fields used: WeekNumber and Year from Time table are whole numbers.

 

It doesn't really make sense to me, any tips on how to fix it? 

 

Also maybe there is a better way to get LastWeekLastYear, do you know of any? 

 

Thanks 

1 ACCEPTED SOLUTION
Icey
Community Support
Community Support

Hi @Anonymous ,

 

Since the error pointed out that it was a data type issue, could you double check the data type of Time[WeekNumber] and Time[Year] columns? Or, if the expression works with "VALUE" function, the data type of the two columns is indeed text.

 

LastYearLastWeek :=
CALCULATE (
[x],
FILTER (
ALL ( Time ),
Time[WeekNumber]
= VALUE ( SELECTEDVALUE ( Time[WeekNumber] ) ) - 1
&& Time[Year]
= VALUE ( SELECTEDVALUE ( Time[Year] ) ) - 1
)
)

 

Then, is [x] a column or a measure? If it is a column, it may need to use SUM, MAX, etc, functions with [x].

 

 

 

Best Regards,

Icey

 

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

View solution in original post

2 REPLIES 2
Icey
Community Support
Community Support

Hi @Anonymous ,

 

Since the error pointed out that it was a data type issue, could you double check the data type of Time[WeekNumber] and Time[Year] columns? Or, if the expression works with "VALUE" function, the data type of the two columns is indeed text.

 

LastYearLastWeek :=
CALCULATE (
[x],
FILTER (
ALL ( Time ),
Time[WeekNumber]
= VALUE ( SELECTEDVALUE ( Time[WeekNumber] ) ) - 1
&& Time[Year]
= VALUE ( SELECTEDVALUE ( Time[Year] ) ) - 1
)
)

 

Then, is [x] a column or a measure? If it is a column, it may need to use SUM, MAX, etc, functions with [x].

 

 

 

Best Regards,

Icey

 

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

Hi

i m trying to extract first X digits out of my ID column of data as

 

Match-ID = IF('ATL-270524'[NTN-FBR] = 9, LEFT('ATL-270524'[NTN-FBR], 7), LEFT('ATL-270524'[NTN-FBR], 11))
but this resulted in error as "DAX comparison operations do not support comparing values of type Text with values of type Integer. Consider using the VALUE or FORMAT function to convert one of the values."
 
basically the field "NTN-FBR" is having digits plus "-" dash in few cases that is why i've kept data type of this field as "TEXT"
 
kindly guide ASAP.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 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.