Search code examples
powerbiconditional-statementsconcatenationpowerquerym

PowerBI custom combined column with Text.Combine and with embeded conditions leading to the insertion of different strings


I created a custom column in PowerBI, which concatenate columns.

I have the following:

Text.Combine({[Nip],[Nap],[Noup]]},"_")

However, I would like to have a specific text which change based on whether or not data is present in columns. I need to check if there is data in four columns. If there is data, a specific string of character should be inserted, if there is not, no data should be inserted.

I am trying to insert the outcome of the "IF"s, but there is some complexity, I have tried this, but this is not working, Power BI is telling me "Token Eof expected" :

If [Lapino] <> null or [Lapinou] <> null or [Werwolf] <> null or [Ciocolato] then 

Text.Combine({[Nip],"Snoubadiuba",[Nap],[Noup]},"_")

else Text.Combine({[Nip],"BruttoCativo",[Nap],[Noup]},"_")

Solution

  • I believe this is as simple as changing your If to lowercase if. M code is case-sensitive.