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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
EimearC
Frequent Visitor

Expression Error assistance: We cannot convert the value xx to type Text

Hi there,

I am trying to do an IF statement where it checks if there is text within a cell, if thre is text then I need the cells concatenated, if there is no text then I need them to SUM. The SUM part works fine on its own but once I wrap the IF statement in there, then I get the above expression error, I'd be grateful if anyone would have a solution please? 

 

Adding custom column code: if not Text.Contains([Primary Motor], "x") or not Text.Contains([Secondary Motor], "x") then [Primary Motor] + [Secondary Motor] else Text.From([Primary Motor]) & ", " & Text.From([Secondary Motor])

 

EimearC_0-1691448757950.png

EimearC_1-1691448774211.png

 

EimearC_2-1691448787337.png

 

Thank you so much

 

1 ACCEPTED SOLUTION
Rickmaurinus
Helper V
Helper V

You could try something like: 

 

if  [Primary Motor] is text and [Secondary Motor] is text then Text.Combine( {[Primary Motor], [Secondary Motor]}) else [Primary Motor] + [Secondary Motor]

 

--------------------------------------------------

@ me in replies or I'll lose your thread

 

Master Power Query M? -> https://powerquery.how

Read in-depth articles? -> BI Gorilla

Youtube Channel: BI Gorilla

 

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

View solution in original post

3 REPLIES 3
EimearC
Frequent Visitor

Hi Vijay, I received the same error when I attempted to use the Number.From but thank you so much for responding to me. 

Rick, your solution worked perfectly, thank you both so much! 

Rickmaurinus
Helper V
Helper V

You could try something like: 

 

if  [Primary Motor] is text and [Secondary Motor] is text then Text.Combine( {[Primary Motor], [Secondary Motor]}) else [Primary Motor] + [Secondary Motor]

 

--------------------------------------------------

@ me in replies or I'll lose your thread

 

Master Power Query M? -> https://powerquery.how

Read in-depth articles? -> BI Gorilla

Youtube Channel: BI Gorilla

 

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

Vijay_A_Verma
Super User
Super User

Replace this part

[Primary Motor] + [Secondary Motor] 

With

Number.From([Primary Motor])+Number.From([Secondary Motor])

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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