Forum Discussion
RANKX not operating on correct level
Hi all,
I'm trying to rank blog posts by view count, but for some reason it's ranking the only each author's posts amongst themselves, as opposed to looking over the entire dataset to rank page vs page. Has anyone got a clue how to fix this?
Page Rank =
RANKX(ALL('Hub Page Data'),[Sum of page views],1,0)
Kind regards,
Jordan
11 Replies
- AnonymousNot applicable
Hi Anonymous
Please try the below DAX
RANKX(ALLEXPECT(Table,Table[Creator],Table[Page Title]),Table[Views])
- AnonymousNot applicableHi Anonymous ,I tried this but it seemed to make no difference. What else could I try?
Page Rank = RANKX(ALLEXCEPT('Hub Page Data','Hub Page Data'[Creator],'Hub Page Data'[Page Title]),'Hub Page Data'[Sum of page views])Kind regards,
Jordan
- aj1973
Community Champion
Hi Anonymous
Use you Rank measure this way
Page Rank =
RANKX(ALL('Hub Page Data'),[Sum of page views], ,DESC)no need for 1 and 0
- AnonymousNot applicable
still no luck 😞
- aj1973
Community Champion
Hi Anonymous
You need to first add a separate measure
Sum Users = SUM('All Web Site Data'[New Users])then add another measureRank = RANKX(ALL('All Web Site Data'), [Sum Users] )
- selimovd
Most Valuable Professional
Hey Anonymous ,
from which tables do you use the all the column in this table?
Could you provide the file if the content is not sensitive? This would make it easier to find the error.
Thank you and best regards
Denis
- AnonymousNot applicable
selimovd Hi Denis,
Link to 1 Drive file is below. Thank you for looking into this for me!
https://1drv.ms/u/s!Aox2dQrFw5CYhmw7uhP80MiXp7Fz?e=ymowis
Kind regards,
Jordan
- selimovd
Most Valuable Professional
Hey Anonymous ,
in this case you have to follow 2 things:
1. Make the whole table available with ALL()
2. Use context transition for the measure itself with CALCULATE
So the following measure gives you the rank:
Rank New User = RANKX( ALL( 'All Web Site Data' ), CALCULATE( SUM( 'All Web Site Data'[New Users] ) ) )Let me know if that works and if you can transition that to your original problem.
If you need any help please let me know.If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍Best regardsDenisBlog: WhatTheFact.bi