Forum Discussion
jums
3 years agoFrequent 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
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 .
1 Reply
- lbendlinSuper 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.