Forum Discussion

gaurav-narchal's avatar
5 years ago
Solved

Match and Get the value

Hello

 

How can i write a measure - If ProductCode is 47, return the value 10 and if the ProductCode if 48, return the value 15 else return 0.

 

Table Name Poduct Codes

Feild Name ProductCode

 

ProductCode
47
47
48
48
48
49
47
49
48
50

 

 

  • Hi, gaurav-narchal 

    Please check the below.

    I could only create calculated column.

    The reason is that there is no id column and, for instance, three of 47 will only appear once in the table visualization.

     

     

    New CC =
    SWITCH( 'Product Codes'[ProductCode],
    47, 10,
    48, 15,
    0)
     

    Hi, My name is Jihwan Kim.


    If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.


    Linkedin: linkedin.com/in/jihwankim1975/

    Twitter: twitter.com/Jihwan_JHKIM

1 Reply

  • Hi, gaurav-narchal 

    Please check the below.

    I could only create calculated column.

    The reason is that there is no id column and, for instance, three of 47 will only appear once in the table visualization.

     

     

    New CC =
    SWITCH( 'Product Codes'[ProductCode],
    47, 10,
    48, 15,
    0)
     

    Hi, My name is Jihwan Kim.


    If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.


    Linkedin: linkedin.com/in/jihwankim1975/

    Twitter: twitter.com/Jihwan_JHKIM