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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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

Top Solution Authors