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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
jums
Frequent Visitor

ranking customers in a matrix using a dynamic filter

I have a superstore sales dataset 2011-2015. I want to to rank Customers using a dynamic filter Top,5,20,30,100. by total volume bought.

this is the pbix

https://ln5.sync.com/dl/3c5d67f70/jbxxwhgw-5rd3agfb-p9jte22c-tewk8c7u

 

The matrix show customers in rows, sub categories in columns and the value is the quantity(named as volume) of each sub category divided by the total quantity the customer bought. The various measures used are in the file .

my tables 

jums_1-1676642953623.png

 

Measures used in the dashboard

1)Ranking Select = IF(HASONEVALUE('Ranking Selections'[Ranking]), VALUES('Ranking Selections'[Rank Number]),20000)
 
2)Total Volume (LBS) =
SUMX(
    FactTrans,
    FactTrans[Quantity]
)
 
I tried to create this measure for the matrix  
3)Top Customers by  Volume subcategoryincluded =
VAR RankingDimension = VALUES(DimCustomers[Customer Name])
VAR RankingSelect = [Ranking Select]

RETURN
CALCULATE(
 CALCULATE(
    [Total Volume (LBS)],
    ALLEXCEPT(
        'DimItems',
        DimItems[Sub-Category])
        ) / CALCULATE(
            [Total Volume (LBS)],
            ALL('DimItems')
            ),
    FILTER(RankingDimension,
        RANKX(ALL(DimCustomers[Customer Name]),[Total Volume (LBS)], ,DESC) <= RankingSelect)
        )
 
However I don't get the image below which I want as the expected result.
 
 

If Top 5 is selected this is the expexted result .

 

jums_2-1676643003077.pngjums_0-1676641575881.png

 

 

1 REPLY 1
lbendlin
Super User
Super User

I want to to rank Customers using a dynamic filter Top,5,20,30,100. by total volume bought.

You don't need ranking for that. A simple sort descending by volume bought already gives you the desired result.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

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.

Top Solution Authors