Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
gauravnarchal
Post Prodigy
Post Prodigy

Measure in If Statement and Return

Hello – How can I create a measure to show

 

If Product code = 10 return 30 or

If Product code = 12 return 50 or

If Product code = 13 return 70

 

Tabel Name = Sale

 

NameBranchProduct Code(Measure) Add column and show the value in each row
ABC IntlNYC1030
ZZZ LogisticsLON1030
ABC IntlCAI1250
ZZZ LogisticsMEL1250
ABC IntlDEL1250
ABC IntlSHA1370
ABC IntlNYC1370
ZZZ LogisticsNYC1370
2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

hi @gauravnarchal 
you can use this measure you will get result

Measure =
var a=SUM(sale[Product Code])
var b=IF(a=10,30,IF(a=12,50,IF(a=13,70)))
Return
b
 
 

View solution in original post

Jihwan_Kim
Super User
Super User

Hi, @gauravnarchal 

Please check the below. The formula is for creating a new column.

 

Picture1.png

 

New Column =
SWITCH ( Sale[Product Code], 10, 30, 12, 50, 13, 70 )

 

 

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 accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

2 REPLIES 2
Jihwan_Kim
Super User
Super User

Hi, @gauravnarchal 

Please check the below. The formula is for creating a new column.

 

Picture1.png

 

New Column =
SWITCH ( Sale[Product Code], 10, 30, 12, 50, 13, 70 )

 

 

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 accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
Anonymous
Not applicable

hi @gauravnarchal 
you can use this measure you will get result

Measure =
var a=SUM(sale[Product Code])
var b=IF(a=10,30,IF(a=12,50,IF(a=13,70)))
Return
b
 
 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors