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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
MSAYED26
Helper II
Helper II

Dax

CodeName  
PM 750 MGAmeasure120
CD-6"ASXBmeasure240
500-182-30Cmeasure335
CD-12"CPD  
2046SB  
103-137D  
530-123C  
CD-30DCE  
CD-30DCA  
CD-30DCF  
CD-30DCF  
CD-30DCE  
CD-20APXA  
CD-20APXG  
CD-20APXC  
CD-20APXG  
192-630-10C  

I want to write a Dax measure to calculate (measure1 /2) if name =A or B, (measure2 /5) if name =C or D or E,(measure3 /7) if name =F or G 

Thanks,,,,

1 ACCEPTED SOLUTION
ChiragGarg2512
Solution Sage
Solution Sage

@MSAYED26 

1) Create a measure that changes with the selection in the filter. Ex. measure4 = values(name)

 

2.1) create another measure using switch statement. measure5 = switch(measure4, "A", [measure 1]/2, "B", [measure 1]/2, .......).

OR

It can also be done with IF statement.

2.2) It can also be done with IF statement. 

Measure 5 = IF([Measure4] IN{"A", "B"}, [Measure 1] /2, IF([Measure4] IN{"C", "D", "E"}, [measure 2]/5, [measure 3]/7))

 

View solution in original post

3 REPLIES 3
ChiragGarg2512
Solution Sage
Solution Sage

@MSAYED26 

1) Create a measure that changes with the selection in the filter. Ex. measure4 = values(name)

 

2.1) create another measure using switch statement. measure5 = switch(measure4, "A", [measure 1]/2, "B", [measure 1]/2, .......).

OR

It can also be done with IF statement.

2.2) It can also be done with IF statement. 

Measure 5 = IF([Measure4] IN{"A", "B"}, [Measure 1] /2, IF([Measure4] IN{"C", "D", "E"}, [measure 2]/5, [measure 3]/7))

 

I mean measure1/2 it divide measure1  /  2

Divide the measures OR divide measure1 by measure2

Also the previous response has been edited, see if that works.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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