Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello team,
I have a Brand & product column in heirarchy in matrix visual along with sales I want rank based on Brand If visual is not expanded and if visual is expaned then it should return rank based on product. I also have slicers on the page.
It should not have ties, My dataset has around 14 million rows so COUNTROWS doesn't seem to work.
Total Sales = SUM( Sales[Amount] )
Ranking =
switch( TRUE(),
ISINSCOPE( Products[Prod Name] ),
var ProductsForRanking =
CALCULATETABLE(
DISTINCT( Products[ProductID] ),
DISTINCT( Products[Brand] ),
ALLSELECTED( Products )
)
var Rank_ =
RANKX(
ProductsForRanking,
CALCULATE(
[Total Sales],
ALLEXCEPT( Products, Products[ProductID] )
),
[Total Sales],
DESC,Dense
)
return
Rank_,
ISINSCOPE( Products[Brand] ),
var BrandsForRanking =
CALCULATETABLE(
DISTINCT( Products[Brand] ),
ALLSELECTED( Products )
)
var Rank_ =
RANKX(
BrandsForRanking,
[Total Sales],,
DESC,Dense
)
return
Rank_
)
User | Count |
---|---|
25 | |
11 | |
8 | |
6 | |
6 |
User | Count |
---|---|
30 | |
13 | |
11 | |
9 | |
6 |