Forum Discussion
Anonymous
6 years agoNot applicable
RANKX issue
i am trying to do a ranking by total and by months but for some reaosn when i am doing the ranking i am geting rankings for months that havent even happened please see below;
- 6 years ago
Hi Anonymous ,
Please create measures like this.
Measure = CALCULATE( SUM(Sales[Sale 2014]), FILTER( ALL(Sales), Sales[Month] = MAX(Sales[Month]) && Sales[CountryRegion] = MAX(Sales[CountryRegion]) ) )Measure 2 = VAR x = RANKX( FILTER( ALLSELECTED(Sales), Sales[Month] = MAX(Sales[Month]) ), [Measure], , ASC, Dense ) VAR y = RANKX( FILTER( ALLSELECTED(Sales), Sales[CountryRegion] = MAX(Sales[CountryRegion]) ), [Measure], , ASC, Dense ) RETURN IF( HASONEFILTER(Sales[CountryRegion]), x, y )Best regards,
Lionel ChenIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-lionel-msft
6 years agoCommunity Support
Hi Anonymous ,
Like this?
Measure =
CALCULATE(
SUM(Sales[Sale 2014]),
FILTER(
ALL(Sales),
Sales[Month] = MAX(Sales[Month])&& Sales[CountryRegion] = MAX(Sales[CountryRegion])
)
)Measure 2 =
RANKX(
FILTER( ALLSELECTED(Sales), Sales[CountryRegion] = MAX(Sales[CountryRegion]) ),
[Measure],
, ASC, Dense
)
Or like this?
Measure 3 =
CALCULATE(
SUM(Sales[Sale 2014]),
FILTER(
ALL(Sales),
Sales[Month] = MAX(Sales[Month])
)
)Measure 4 =
RANKX(
FILTER( ALLSELECTED(Sales),Sales[CountryRegion] = MAX(Sales[CountryRegion]) ),
[Measure 3],
, ASC, Dense
)
Best regards,
Lionel Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.