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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

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
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.