Forum Discussion
Switch true expression not working
- Anonymous5 years ago
Hi Anonymous,
I have modified your custom column syntax try this
= Table.AddColumn(Source, "PIPING-INT", each if Text.Contains([#"SAP Task-3"], "PIPING") and Text.Contains([#"SAP Task-2"], "INT") then "PIPING-INT" else if Text.Contains([#"SAP Task-4"], "PIPING") and Text.Contains([#"SAP Task-2"], "INT") then "PIPING-INT" else if Text.Contains([#"SAP Task-5"], "PIPING") and Text.Contains([#"SAP Task-2"], "INT") then "PIPING-INT" else if Text.Contains([#"SAP Task-6"], "PIPING") and Text.Contains([#"SAP Task-2"], "INT") then "PIPING-INT" else if Text.Contains([#"SAP Task-7"],"PIPING") and Text.Contains([#"SAP Task-2"], "INT") then "PIPING-INT" else if Text.Contains([#"SAP Task -8"],"PIPING") and Text.Contains([#"SAP Task-2"], "INT") then "PIPING-INT" else "False")
Thanks
Lavdeep
Hi Anonymous
You're mixing up M in Power Query and DAX (the SWITCH function). Can't use DAX in M queries.
Maybe if you explain what you are trying todo and supply some sampe data we can find a solution.
Phil
If I answered your question please mark my post as the solution.
If my answer helped solve your problem, give it a kudos by clicking on the Thumbs Up.
- Anonymous5 years agoNot applicable
Thanks Phillip,
I am trying to use switch true in Power bi power query for
converting following nested if using switch
if [#"SAP Task-3"] = "PIPING" and [#"SAP Task-2"] = "INT"then "PIPING-INT" else if [#"SAP Task-4"]="PIPING"and [#"SAP Task-2"]="INT" then "PIPING-INT"else if [#"SAP Task-5"]="PIPING"and [#"SAP Task-2"]="INT" then "PIPING-INT"else if [#"SAP Task-6"]="PIPING"and [#"SAP Task-2"]="INT" then "PIPING-INT"else if [#"SAP Task-7"]="PIPING"and [#"SAP Task-2"]="INT" then "PIPING-INT"else if [#"SAP Task -8"]="PIPING"and [#"SAP Task-2"]="INT" then "PIPING-INT"else "FALSE"
- PhilipTreacy5 years agoSuper User
Hi Anonymous
Can you please supply your PBIX file with sample data. I need to see the structure of your data.
Phil
If I answered your question please mark my post as the solution.
If my answer helped solve your problem, give it a kudos by clicking on the Thumbs Up.- Anonymous5 years agoNot applicable
Hi Philip,
I shall not be able to provide you the same, my question is very simple, How to create Switch true query in Power query editor