Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

SQL CASE statement equivalent to in DAX

hi , I m developing a powerbi matrix report and my row data is a look up column and I have to group  some values into one value ..

example - IF the column has values AB or BC or
CZ then display as NEW, IF values are FE of ZS then OLD Else NORMAL

In SQL I can easily write CASE statement . My data source is sales force . can anyone plz give me the DAX query to achieve my requirement so tat I can then use tat column in my matrix rows ?

 

  • Hello Anonymous ,

     

    you can realize that in DAX with the Switch function and a TRUE() statement.

    Check the following article:

    DAX - The Diabolical Genius of “SWITCH TRUE”

     

    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 regards
    Denis

    Blog: WhatTheFact.bi

2 Replies

  • selimovd's avatar
    selimovd
    Most Valuable Professional

    Hello Anonymous ,

     

    you can realize that in DAX with the Switch function and a TRUE() statement.

    Check the following article:

    DAX - The Diabolical Genius of “SWITCH TRUE”

     

    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 regards
    Denis

    Blog: WhatTheFact.bi

  • Anonymous's avatar
    Anonymous
    Not applicable

    SWITCH TRUE worked like a magic to me.