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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
bluetronics
Helper III
Helper III

How to use switch function

Hello All,

Anyone can teach me how to get the result withot filter like below:

 

8020 Pic.png

bluetronics_0-1661916914047.png

 

Dax that I typed in:

 

Customer_80-20 = SWITCH(true(), Sheet1[Cumulated % of Customer] <=0.8"80""20")
Product_80-20 = SWITCH(true(), Sheet1[Cumulated % of Productt] <=0.8"80""20")
Rank by Customer = Rankx(ALLSELECTED(Sheet1[Customer]),calculate(sum(Sheet1[Revenue])),,DESC,Skip)
Rank by Product = Rankx(ALLSELECTED(Sheet1[product]),calculate(sum(Sheet1[Revenue])),,DESC,Skip)
Cumulated % of Customer =
VAR CurrentCustomerRank = [Rank by Customer]
Return SUMX(FILTER(ALLSELECTED(Sheet1[Customer]), [Rank by Customer]<= CurrentCustomerRank),
CALCULATE(SUM(Sheet1[Revenue])/CALCULATE(SUM(Sheet1[Revenue]), all(Sheet1[Customer]))))
Cumulated % of Product =
VAR CurrentProductRank = [Rank by Product]
Return SUMX(FILTER(ALLSELECTED(Sheet1[Product]), [Rank by Product]<= CurrentProductRank),
CALCULATE(SUM(Sheet1[Revenue])/CALCULATE(SUM(Sheet1[Revenue]), all(Sheet1[Product]))))
 
Customer_Product_80-20 SWITCH(True(),
Sheet1[Cumulated % of Customer] <= 0.8 && Sheet1[Cumulated % of Product] <= 0.8"80-80",
Sheet1[Cumulated % of Customer] <= 0.8 && Sheet1[Cumulated % of Product] > 0.8"80-20",
Sheet1[Cumulated % of Customer] > 0.8 && Sheet1[Cumulated % of Product] <= 0.8"20-80",
Sheet1[Cumulated % of Customer] > 0.8 && Sheet1[Cumulated % of Product] > 0.8"20-80")
1 ACCEPTED SOLUTION

Hi @bluetronics ,

 

Please try the measure.

 

Measure = CALCULATE( [Customer_80-20], ALLSELECTED(Sheet1[Product])) & "-" & CALCULATE([Product_80-20], ALLSELECTED(Sheet1[Customer]))

vkkfmsft_0-1663210681315.png

 

View solution in original post

3 REPLIES 3
bluetronics
Helper III
Helper III

Link of Power BI file sample for the test run.  Thank you for coaching me in advance if you know the solution.

https://bigfile.mail.naver.com/download?fid=imeXM6kZWrnZHqujMB+CKx2mFA2mHqUmKoUmaxudKxbmFqU/HqurFoEX...

Hi @bluetronics ,

 

Please try the measure.

 

Measure = CALCULATE( [Customer_80-20], ALLSELECTED(Sheet1[Product])) & "-" & CALCULATE([Product_80-20], ALLSELECTED(Sheet1[Customer]))

vkkfmsft_0-1663210681315.png

 

Hi v-kkf-msft,

Thank you for providing me a solution. it works perfectly.

Best Regards,

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.