This formula seems way to complicated. Far more than it needs to be.

**SIMPLIFY here.**

```
2.Dynamic Rank. =
SWITCH(TRUE(),
//Customer Sales
Metric[Metric Selected] = "Total Sale" && [Rank Number] = 3 && [RankColumn] = "Customers",
CALCULATE([Total Sales],FILTER(VALUES(Customer[Customer Names]),RANKX(ALL(Customer),[Total Sales],,DESC)<=3)),
Metric[Metric Selected] = "Total Sale" && [Rank Number] = 5 && [RankColumn] = "Customers",
CALCULATE([Total Sales],FILTER(VALUES(Customer[Customer Names]),RANKX(ALL(Customer),[Total Sales],,DESC)<=5)),
Metric[Metric Selected] = "Total Sale" && [Rank Number] = 10 && [RankColumn] = "Customers",
CALCULATE([Total Sales],FILTER(VALUES(Customer[Customer Names]),RANKX(ALL(Customer),[Total Sales],,DESC)<=10)),
Metric[Metric Selected] = "Total Sale" && [Rank Number] = 15 && [RankColumn] = "Customers",
CALCULATE([Total Sales],FILTER(VALUES(Customer[Customer Names]),RANKX(ALL(Customer),[Total Sales],,DESC)<=15)),
Metric[Metric Selected] = "Total Sale" && [Rank Number] = 20 && [RankColumn] = "Customers",
CALCULATE([Total Sales],FILTER(VALUES(Customer[Customer Names]),RANKX(ALL(Customer),[Total Sales],,DESC)<=20)),
//Customer Profit
Metric[Metric Selected] = "Total Profit" && [Rank Number] = 3 && [RankColumn] = "Customers",
CALCULATE([Total Profit],FILTER(VALUES(Customer[Customer Names]),RANKX(ALL(Customer),[Total Profit],,DESC)<=3)),
Metric[Metric Selected] = "Total Profit" && [Rank Number] = 5 && [RankColumn] = "Customers",
CALCULATE([Total Profit],FILTER(VALUES(Customer[Customer Names]),RANKX(ALL(Customer),[Total Profit],,DESC)<=5)),
Metric[Metric Selected] = "Total Profit" && [Rank Number] = 10 && [RankColumn] = "Customers",
CALCULATE([Total Profit],FILTER(VALUES(Customer[Customer Names]),RANKX(ALL(Customer),[Total Profit],,DESC)<=10)),
Metric[Metric Selected] = "Total Profit" && [Rank Number] = 15 && [RankColumn] = "Customers",
CALCULATE([Total Profit],FILTER(VALUES(Customer[Customer Names]),RANKX(ALL(Customer),[Total Profit],,DESC)<=15)),
Metric[Metric Selected] = "Total Profit" && [Rank Number] = 20 && [RankColumn] = "Customers",
CALCULATE([Total Profit],FILTER(VALUES(Customer[Customer Names]),RANKX(ALL(Customer),[Total Profit],,DESC)<=20)),
//Customer Profit Margin
Metric[Metric Selected] = "Profit Margin" && [Rank Number] = 3 && [RankColumn] = "Customers",
FORMAT(CALCULATE([Proft Margin],FILTER(VALUES(Customer[Customer Names]),RANKX(ALL(Customer),[Proft Margin],,DESC)<=3)),"0.0%"),
Metric[Metric Selected] = "Profit Margin" && [Rank Number] = 5 && [RankColumn] = "Customers",
FORMAT(CALCULATE([Proft Margin],FILTER(VALUES(Customer[Customer Names]),RANKX(ALL(Customer),[Proft Margin],,DESC)<=5)),"0.0%"),
Metric[Metric Selected] = "Profit Margin" && [Rank Number] = 10 && [RankColumn] = "Customers",
FORMAT(CALCULATE([Proft Margin],FILTER(VALUES(Customer[Customer Names]),RANKX(ALL(Customer),[Proft Margin],,DESC)<=10)),"0.0%"),
Metric[Metric Selected] = "Profit Margin" && [Rank Number] = 15 && [RankColumn] = "Customers",
FORMAT(CALCULATE([Proft Margin],FILTER(VALUES(Customer[Customer Names]),RANKX(ALL(Customer),[Proft Margin],,DESC)<=15)),"0.0%"),
Metric[Metric Selected] = "Profit Margin" && [Rank Number] = 20 && [RankColumn] = "Customers",
FORMAT(CALCULATE([Proft Margin],FILTER(VALUES(Customer[Customer Names]),RANKX(ALL(Customer),[Proft Margin],,DESC)<=20)),"0.0%"),
//Product Sales
Metric[Metric Selected] = "Total Sale" && [Rank Number] = 3 && [RankColumn] = "Product",
CALCULATE([Total Sales],FILTER(VALUES(Products[Product Name]),RANKX(ALL(Products),[Total Sales],,DESC)<=3)),
Metric[Metric Selected] = "Total Sale" && [Rank Number] = 5 && [RankColumn] = "Product",
CALCULATE([Total Sales],FILTER(VALUES(Products[Product Name]),RANKX(ALL(Products),[Total Sales],,DESC)<=5)),
Metric[Metric Selected] = "Total Sale" && [Rank Number] = 10 && [RankColumn] = "Product",
CALCULATE([Total Sales],FILTER(VALUES(Products[Product Name]),RANKX(ALL(Products),[Total Sales],,DESC)<=10)),
Metric[Metric Selected] = "Total Sale" && [Rank Number] = 15 && [RankColumn] = "Product",
CALCULATE([Total Sales],FILTER(VALUES(Products[Product Name]),RANKX(ALL(Products),[Total Sales],,DESC)<=15)),
Metric[Metric Selected] = "Total Sale" && [Rank Number] = 20 && [RankColumn] = "Product",
CALCULATE([Total Sales],FILTER(VALUES(Products[Product Name]),RANKX(ALL(Products),[Total Sales],,DESC)<=20)),
//Product Profit
Metric[Metric Selected] = "Total Profit" && [Rank Number] = 3 && [RankColumn] = "Product",
CALCULATE([Total Profit],FILTER(VALUES(Products[Product Name]),RANKX(ALL(Products),[Total Profit],,DESC)<=3)),
Metric[Metric Selected] = "Total Profit" && [Rank Number] = 5 && [RankColumn] = "Product",
CALCULATE([Total Profit],FILTER(VALUES(Products[Product Name]),RANKX(ALL(Products),[Total Profit],,DESC)<=5)),
Metric[Metric Selected] = "Total Profit" && [Rank Number] = 10 && [RankColumn] = "Product",
CALCULATE([Total Profit],FILTER(VALUES(Products[Product Name]),RANKX(ALL(Products),[Total Profit],,DESC)<=10)),
Metric[Metric Selected] = "Total Profit" && [Rank Number] = 15 && [RankColumn] = "Product",
CALCULATE([Total Profit],FILTER(VALUES(Products[Product Name]),RANKX(ALL(Products),[Total Profit],,DESC)<=15)),
Metric[Metric Selected] = "Total Profit" && [Rank Number] = 20 && [RankColumn] = "Product",
CALCULATE([Total Profit],FILTER(VALUES(Products[Product Name]),RANKX(ALL(Products),[Total Profit],,DESC)<=20)),
//Product Profit Margin Ranknig
Metric[Metric Selected] = "Profit Margin" && [Rank Number] = 3 && [RankColumn] = "Product",
FORMAT(CALCULATE([Proft Margin],FILTER(VALUES(Products[Product Name]),RANKX(ALL(Products),[Proft Margin],,DESC)<=3)),"0.0%"),
Metric[Metric Selected] = "Profit Margin" && [Rank Number] = 5 && [RankColumn] = "Product",
FORMAT(CALCULATE([Proft Margin],FILTER(VALUES(Products[Product Name]),RANKX(ALL(Products),[Proft Margin],,DESC)<=5)),"0.0%"),
Metric[Metric Selected] = "Profit Margin" && [Rank Number] = 10 && [RankColumn] = "Product",
FORMAT(CALCULATE([Proft Margin],FILTER(VALUES(Products[Product Name]),RANKX(ALL(Products),[Proft Margin],,DESC)<=10)),"0.0%"),
Metric[Metric Selected] = "Profit Margin" && [Rank Number] = 15 && [RankColumn] = "Product",
FORMAT(CALCULATE([Proft Margin],FILTER(VALUES(Products[Product Name]),RANKX(ALL(Products),[Proft Margin],,DESC)<=15)),"0.0%"),
Metric[Metric Selected] = "Profit Margin" && [Rank Number] = 20 && [RankColumn] = "Product",
FORMAT(CALCULATE([Proft Margin],FILTER(VALUES(Products[Product Name]),RANKX(ALL(Products),[Proft Margin],,DESC)<=20)),"0.0%"),
//Region Ranking Sale
Metric[Metric Selected] = "Total Sale" && [Rank Number] = 3 && [RankColumn] = "Region",
CALCULATE([Total Sales],FILTER(VALUES(Regions[City]),RANKX(ALL(Regions),[Total Sales],,DESC)<=3)))
```

Please review this tutorial here that goes through the exact technique to use for dynamic ranking.