Forum Discussion
jb123
9 years agoFrequent Visitor
How to create a calculated column with multiple conditions?
I need to create a column based on values in different columns. I can easily create a rule for the column if the value in either column is true or false. Here is what I have for the query: = T...
- 9 years ago
You are close. & must be and.
= Table.AddColumn(#"Renamed Columns", "EDU_NP", each if [IsEDU] = true and [IsNonProfit] = true then "EDU/NP" else if [IsEDU] = true then "EDU" else if [IsNonProfit] = true then "HP" else null)
Remark: if all fields have true/false values (no other values or nulls), then you can omit the "= true"'s.
MarcelBeug
9 years agoCommunity Champion
You are close. & must be and.
= Table.AddColumn(#"Renamed Columns", "EDU_NP", each if [IsEDU] = true and [IsNonProfit] = true then "EDU/NP" else if [IsEDU] = true then "EDU" else if [IsNonProfit] = true then "HP" else null)
Remark: if all fields have true/false values (no other values or nulls), then you can omit the "= true"'s.
- jb1239 years agoFrequent Visitor
That worked - thanks :)