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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

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 carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.