Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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
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
@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
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.
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
Regards
Amine Jerbi
If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook
still no luck 😞
Hi @Anonymous
You need to first add a separate measure
Regards
Amine Jerbi
If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook
Using a measure triggers context transition or using CALCULATE triggers context transition.
In general, we use CALCULATE when we modify the filter context, not only when we filter an expression, or we use it when we have to trigger context transition like in this case.
So both of our solutions are doing the same, your solution with an additional measure, mine with one measure.
Also, check the article from SQLBI, this will help you to understand context transition a little better:
Understanding Context Transition - SQLBI
But your approach is also totally fine.
Best regards
Denis
Well my apologies, may be I should have said " Better use CALCULATE to filter an expression ".
Peace 😁
Regards
Amine Jerbi
If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook
@aj1973 Was not meant in an offensive way, I also just recently found out about the context transition with Calculate only 😉
But it's pretty mind blowing once you dig a little deeper.
But as I said when you have 2 measures, your solution is perfect.
Best regards
Denis
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
Hi @Anonymous
Please try the below DAX
RANKX(ALLEXPECT(Table,Table[Creator],Table[Page Title]),Table[Views])
Hope it resolves your issue? Did I answer your question? Mark my post as a solution! Appreciate your Kudos, Press the thumbs up button!! Linkedin Profile |
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
103 | |
101 | |
76 | |
66 | |
60 |
User | Count |
---|---|
142 | |
106 | |
103 | |
85 | |
70 |