cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Helper III

## How to use switch function

Hello All,

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

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
Community Support

Hi @bluetronics ,

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

3 REPLIES 3
Helper III

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

Community Support

Hi @bluetronics ,

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

Helper III

Hi v-kkf-msft,

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

Best Regards,

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

#### Power BI Monthly Update - July 2024

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

#### Fabric Community Update - July 2024

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

Top Solution Authors
Top Kudoed Authors