cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
gaurav-narchal
Helper I
Helper I

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

 

 

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

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.

Picture5.png

 

 

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


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.

Best regards, JiHwan Kim

Linkedin: https://www.linkedin.com/in/jihwankim1975/

Twitter: https://twitter.com/Jihwan_JHKIM

View solution in original post

1 REPLY 1
Jihwan_Kim
Super User
Super User

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.

Picture5.png

 

 

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


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.

Best regards, JiHwan Kim

Linkedin: https://www.linkedin.com/in/jihwankim1975/

Twitter: https://twitter.com/Jihwan_JHKIM

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

November Power BI Update 768x460.png

Check it Out!

Click here to read more about the November 2021 Updates!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.