I have a query table as follows:
For the DAX expression, I used a quick measure with the formula as follows:
Solved! Go to Solution.
Hi,
Please check the below picture and the attached pbix file.
Ranking measure expected result: =
SWITCH (
TRUE (),
ISINSCOPE ( Data[Products] ),
RANKX (
ALL ( Data[Products] ),
CALCULATE ( SUM ( Data[Current volumn] ) ),
,
DESC
),
ISINSCOPE ( Data[Category] ),
RANKX (
ALL ( Data[Category] ),
CALCULATE ( SUM ( Data[Current volumn] ) ),
,
DESC
)
)
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Hey @Dawn7047
the below screenshot shows the ranking for colors inside a brand:
Please be aware that also the Brands are ranked accordingly, I use this measure to create the above output:
Measure 4 =
if( ISINSCOPE('DimProduct'[ColorName] )
// the inner column (colorname) is ranked inside a group (brandname)
, RANKX(
CALCULATETABLE(
SUMMARIZE(
ALLSELECTED( 'FactOnlineSales' )
, 'DimProduct'[BrandName]
, 'DimProduct'[ColorName]
)
, VALUES( 'DimProduct'[BrandName] )
)
, CALCULATE( SUM( 'FactOnlineSales'[SalesAmount] ) )
)
// the outer column (brandname) is ranked
, RANKX(
CALCULATETABLE(
SUMMARIZE(
ALLSELECTED( 'FactOnlineSales' )
, 'DimProduct'[BrandName]
)
)
, CALCULATE( SUM( 'FactOnlineSales'[SalesAmount] ) )
)
)
Hopefully this provides what you are looking for.
Regards,
Tom
Hi,
Please check the below picture and the attached pbix file.
Ranking measure expected result: =
SWITCH (
TRUE (),
ISINSCOPE ( Data[Products] ),
RANKX (
ALL ( Data[Products] ),
CALCULATE ( SUM ( Data[Current volumn] ) ),
,
DESC
),
ISINSCOPE ( Data[Category] ),
RANKX (
ALL ( Data[Category] ),
CALCULATE ( SUM ( Data[Current volumn] ) ),
,
DESC
)
)
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
User | Count |
---|---|
129 | |
61 | |
57 | |
54 | |
43 |
User | Count |
---|---|
124 | |
59 | |
59 | |
56 | |
49 |