cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
arulsettu Frequent Visitor
Frequent Visitor

Rank for particular years

hi i need to show the rank of the countries for praticular years

 

my expreession for rank is

 

Rank = RANKX(ALL('table'[Country]),[Sum_value],,0)

 

i am getting rank for the countries

 

my next step is i want rank for previous year

 

CALCULATE([Rank],FILTER('table','table'[Year]=2012)) 

 

but i am getting 1 for all the countries

 

can any one help on this

 

10 REPLIES 10
arulsettu Frequent Visitor
Frequent Visitor

Re: Rank for particular years

any idea guys ?

Re: Rank for particular years

Hi

 

  Can you share some sample data and how you want to get the result?

 

Just to say in general, you can get rank for country and year as a separate column.

Rank.png

 

 

arulsettu Frequent Visitor
Frequent Visitor

Re: Rank for particular years

i created everything as measure. do you wanr me to create as column

Re: Rank for particular years

Hi

 

Are you ok with the given format? If that is fine then you can replicate the same and get the result.

 

Thanks

Hari

arulsettu Frequent Visitor
Frequent Visitor

Re: Rank for particular years

This is my script for column

 

Rank_dimension = RANKX(ALL('table'[Country]),[Sum_value],,0)

 

for this i am getting below output

 

Capture.JPGrank output

 

my year like this

2011

2012

2013

2014

 

its in whole number data type

 

arulsettu Frequent Visitor
Frequent Visitor

Re: Rank for particular years

i created like the image you posted 

 

Rank_dimension = RANKX(ALL('table'[Country]),'table'[Country])

 

iam getting the different ranks. upto this fine

 

now i need the rank for 2 years

 

example 2016 and 2012

 

2012_rank = CALCULATE(SUM([Rank_dimension]),FILTER('table','table'[Year]=2012))

 

2016_rank = CALCULATE(SUM([Rank_dimension]),FILTER('table','table'[Year]=2016))

 

 i am getting same rank for both years

 

can you suggest me how to approach this issue

 

thanks

Highlighted

Re: Rank for particular years

Hi

 

  It might the same number of rows for both the Year. 

 

 In the below screenshot, if you take the Rank_dimension, it has the same number of values because it has same 4 entries. In case if you have a different number of rows then you will get different values.

 

Rank1.png

 To show that, I created another 2 column 2012Yr & 2013Yr with RankYear column and it shows 4 & 8 values.

 

 

arulsettu Frequent Visitor
Frequent Visitor

Re: Rank for particular years

Thanks for the reply

 

but i have different values for 2012 and 2016

 

even getting same rank

 

can you please explain how its defininig the rank

 

Rankx(All(table[country],table[copuntry]))

 

here we are not passing any values right. how its bringing the rank

 

and why i am getting same rank

 

Thanks

arulsettu Frequent Visitor
Frequent Visitor

Re: Rank for particular years

This is the output i am getting

 

Capture.JPG

 

can you see china has different values for 2016 and 2017 but getting same rank

 

can you help me on this

 

 

Helpful resources

Announcements
Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Analytics in Azure virtual event

Analytics in Azure virtual event

Experience a limitless analytics service built to ingest, prep, manage, and serve data for immediate use in Power BI.

Users Online
Currently online: 395 members 4,579 guests