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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.