Forum Discussion
Logical Operators &&& || IN do not work
- 4 years ago
Hi there,
I believe this is because you are using Power Query to create a Custom Column rather than using Power BI Desktop's front end to create a Calculated Column.
Note that Power Query uses the M language. The front end of Power BI Dekstop uses DAX which incorporates logical operators, etc.
Hope this helps.
Theo 🙂 - 4 years ago
The &&, || and IN syntax is for DAX and that is an M expression. This should work instead. You may find it frustrating/confusing, but stick with it. It's worth it. Note too that M is case sensitive, so the and is all lowercase.
if List.Contains({"RBCCM","CITIGMI"}, [Counterparty]) then "EXCH"
else if [Wholesale or Retail] = "WHOLESALE" and [MANUM] <> "INTERBOOK"
and [Risk Trade Type] <> "PHYSICALS"
and not List.Contains({"RBCCM","CITIGMI","PJM","ISONE"}, [Counterparty]) then "OTC" else "OTHER"
Pat
The &&, || and IN syntax is for DAX and that is an M expression. This should work instead. You may find it frustrating/confusing, but stick with it. It's worth it. Note too that M is case sensitive, so the and is all lowercase.
if List.Contains({"RBCCM","CITIGMI"}, [Counterparty]) then "EXCH"
else if [Wholesale or Retail] = "WHOLESALE" and [MANUM] <> "INTERBOOK"
and [Risk Trade Type] <> "PHYSICALS"
and not List.Contains({"RBCCM","CITIGMI","PJM","ISONE"}, [Counterparty]) then "OTC" else "OTHER"
Pat
Thank you very much for your help. List.Contains was the function I was looking for.
Best regards