Forum Discussion
Find value in column a, set value in column b
- 10 years ago
The "easy" way to do this would be to create a new column like Department1 in the query editor and use a formula like:
= if [User Name] = "unknown user" then "unknown user" else [Department]
The "easy" way to do this would be to create a new column like Department1 in the query editor and use a formula like:
= if [User Name] = "unknown user" then "unknown user" else [Department]
- nixonyx10 years agoHelper I
That simple? Feel silly now for not thinking of that, having created other custom columns. Thank you
- nixonyx10 years agoHelper I
Ok, not quite solved.
This is my syntax, which reports no errors when I type it into the new custom column box:
IF([Customer]="Unknown User","Unknown User",[SoV Account Type1])
In the advanced editor it look like (still with no syntax errors):
#"Added Custom1" = Table.AddColumn(#"Renamed Columns", "Custom", each IF([Customer]="Unknown User","Unknown User",[SoV Account Type1]))
However, I cannot view the results as I get this error when I save the custom column/close advanced editor:
"Expression error: The name 'IF' wasn't recognised. Make sure it's spelled correctly."
Is there an issue with using DAX formulae in the advanced editor?
- Greg_Deckler10 years agoCommunity Champion
Can't use DAX in Power Query, DAX is only used after the data gets into the model. Your syntax for DAX is correct, my syntax for "M" (Power Query) is correct for the query editor.
This is the reference for "M"
https://msdn.microsoft.com/en-us/library/mt211003.aspx
This is the reference for DAX
https://msdn.microsoft.com/en-us/library/ee634396.aspx