Forum Discussion
RANKX Returning 1 for every value
- 7 years ago
Hi TomNorth
Try this:
RankingMeasure = IF ( ISFILTERED ( 'Population 2017'[County] ), RANKX ( ALLSELECTED ( 'Population 2017' ), CALCULATE ( SUM ( 'Population 2017'[Population] ) ), , DESC ), RANKX ( ALL ( 'Population 2017'[Ward Name] ), CALCULATE ( SUM ( 'Population 2017'[Population] ) ), , DESC ) )Regards,
Cherie
Hi TomNorth
You may refer to below measure with ALLSELECTED Function. Attached the simplified sample file.Here is the article about RANKX measure for your reference.
Measure =
IF (
ISFILTERED ( 'Population 2017'[County] )
|| ISFILTERED ( 'Population 2017'[Gender] ),
RANKX (
ALLSELECTED ( 'Population 2017' ),
CALCULATE ( SUM ( 'Population 2017'[Population] ) ),
,
DESC
),
RANKX (
ALL ( 'Population 2017'[Ward Name] ),
CALCULATE ( SUM ( 'Population 2017'[Population] ) ),
,
DESC
)
)
Regards,
Cherie
Thank you for your reply. This nearly works so thank you.
With no slicers applied, I have a rank on wards which is great!
With just county slicers applies, its reducing the wards just to that county with dynamic ranking which again is great!
However, when I click on the Gender slicer, (All, Male or Female) the ranking is reverting back to 1's for every ward.
I try applying the gender slicer on its own e.g. just Female without the county slicer on, and the same thing happens that all ranks show as 1. Not sure if you know what this is? I am using this code, the same as your post:
Measure =
IF (
ISFILTERED ( 'Population 2017'[County] )
|| ISFILTERED ( 'Population 2017'[Gender] ),
RANKX (
ALLSELECTED ( 'Population 2017' ),
CALCULATE ( SUM ( 'Population 2017'[Population] ) ),
,
DESC
),
RANKX (
ALL ( 'Population 2017'[Ward Name] ),
CALCULATE ( SUM ( 'Population 2017'[Population] ) ),
,
DESC
)
)
- v-cherch-msft7 years ago
Microsoft Employee
Hi TomNorth
Could you share your sample data which could reproduce your scenario?The measure works for my sample data and i don't know what's the difference between your and my data.You can also upload the pbix file to OneDrive and post the link here. Do mask sensitive data before uploading.
Regards,
Cherie