Forum Discussion
dbehara
4 years agoFrequent Visitor
IF and CASE statement
Hi All, Could anyone please help me with below query on power bi, the query im using on tableau IF NOT ISNULL([task id]) THEN (CASE [activity] WHEN 'Yes' THEN 1 ELSE 0 END) ELSE 0 END Tha...
- 4 years ago
Hey dbehara ,
sorry, that was my mistake. You have to use the double quotes.
Try this one:
New column = SWITCH( TRUE(), myTable[task id] = BLANK(), 0, myTable[activity] = "Yes", 1, 0 )If you need any help please let me know.If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍Best regardsDenisBlog: WhatTheFact.biFollow me: twitter.com/DenSelimovic
selimovd
4 years agoMost Valuable Professional
Hey dbehara ,
what exactly do you want to do? Is that a SQL query? Is that a new calculated column? Should that be a measure?
I think a little bit more context is required to help you.
Best regards
Denis
- dbehara4 years agoFrequent Visitor
selimovd Im using above query on tableau and trying to re-create same on power bi
basically [task id] should not be null, while calculating activity as 'Yes'Hope i have answered 🙂
- selimovd4 years agoMost Valuable Professional
Hey dbehara ,
Power BI is not Tableau, what is the reason I asked where exactly you need that.
In this case I can just guess. An approach for a calculated column would be:
New column = SWITCH( TRUE(), myTable[task id] = BLANK(), 0, myTable[activity] = 'Yes', 1, 0 )If you need any help please let me know.If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍Best regardsDenisBlog: WhatTheFact.biFollow me: twitter.com/DenSelimovic