Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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])
Thank you so much
Solved! Go to Solution.
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.
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!
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.
Replace this part
[Primary Motor] + [Secondary Motor]
With
Number.From([Primary Motor])+Number.From([Secondary Motor])