Forum Discussion
beccar_13
9 years agoNew Member
Custom Query IF statement
I am trying to write an IF statement in the edit query but am having no luck. Is this function available?
- 9 years ago
Neither link mentions what happens if you use and's and or's without parentheses, so here is a little teaser for you:
= if 1 < 2 and 1 < 2 or 1 > 2 and 1 > 2 then """or"" starts a new group" else """and"" starts a new group"
callow
9 years agoRegular Visitor
These threads should be able to give you your answer:
https://community.powerbi.com/t5/Desktop/IF-Statement-Custom-Column/m-p/125631/highlight/true#M53204
- blopez119 years agoSuper User
Most definitely, in the Query Editor, you can do things like:
if ( [AMT] = 0 or [AMT] = null ) and [Units] = 0 then 0
else 1or
if [Code] <> null and [Description] <> null then [Code]&": "&[Description]
else if [Code] <> null then [Code]Hope this helps,
- beccar_139 years agoNew Member
Thank you so much for your help! I really appreciate it!
- MarcelBeug9 years agoCommunity Champion
And bear in mind that Power Query is case sensitive with all keywords in lowercase, so IF won't work,