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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Expression.Error: We cannot apply operator < to types Number and Text

Hello all, I have an below mentioned error

Expression.Error: We cannot apply operator < to types Number and Text

Details:
Operator=<
Left=4
Right=Q9_1

 

I get this while Pivoting , attached the query below

let
Source = #"Data 1 Sheet",
#"Unpivoted Other Columns" = Table.UnpivotOtherColumns(Source, {"Test Name", "Consumer", "Serving Position", "3_digit_Product_Code", "Sample_Name", "Unique Consumer ID", "Unique Product Code"}, "Attribute", "Value"),
#"Filtered Rows1" = Table.SelectRows(#"Unpivoted Other Columns", each Text.EndsWith([Attribute], "_JAR") or Text.Contains([Attribute], "JAR") or Text.Contains([Attribute], "jar") or Text.Contains([Attribute], "Jar")),
#"Added Conditional Column" = Table.AddColumn(#"Filtered Rows1", "Custom", each if [Value] = 1 then "Too Less" else if [Value] = 2 then "Too Less" else if [Value] = 3 then "Just About Right" else if [Value] >= 4 then "Too Strong" else null),
#"Inserted Literal" = Table.AddColumn(#"Added Conditional Column", "Literal", each 1),
#"Changed Type" = Table.TransformColumnTypes(#"Inserted Literal",{{"Literal", Int64.Type}}),
#"Pivoted Column" = Table.Pivot(#"Changed Type", List.Distinct(#"Changed Type"[Custom]), "Custom", "Literal")
in
#"Pivoted Column"

 

Can someone help to solve this error, Thanks!

1 ACCEPTED SOLUTION
jennratten
Super User
Super User

Hello - Power Query is finding a text value when it expects a number.  Based on your script, I would think that it is in the 'Value' column.  I recomend you use Table.FindText before the #"Added Conditional Column" step to locate it.  The text value causing the problem is 'Q9_1'.  

Table.FindText ( #"Filtered Rows1", "Q9_1" )

 

If this post helps to answer your questions, please consider marking it as a solution so others can find it more quickly when faced with a similar challenge.

Proud to be a Microsoft Fabric Super User

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hello @jennratten . Yes there is text value in the Value column, that causes this error.

Thanks for helping me out 👍

jennratten
Super User
Super User

Hello - Power Query is finding a text value when it expects a number.  Based on your script, I would think that it is in the 'Value' column.  I recomend you use Table.FindText before the #"Added Conditional Column" step to locate it.  The text value causing the problem is 'Q9_1'.  

Table.FindText ( #"Filtered Rows1", "Q9_1" )

 

If this post helps to answer your questions, please consider marking it as a solution so others can find it more quickly when faced with a similar challenge.

Proud to be a Microsoft Fabric Super User

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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