Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreWe've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
Hello,
I am looking to rank items based off of their TOTAL page views in my data set. A simple example of what the dataset looks like:
| Item Code | Date | Page Views |
| 123 | November 2022 | 100 |
| 123 | October 2022 | 200 |
| 456 | October 2022 | 50 |
The problem I am having is that the DAX expression I tried using:
Rank = rankx('Data','Data'[Page Views],,DESC)
returns a ranking of each row of page views entries. What I want would look something like this:
| Item Code | Date | Page Views | Rank |
| 123 | November 2022 | 100 | 1 |
| 123 | October 2022 | 200 | 1 |
| 456 | October 2022 | 50 | 2 |
Any help would be much appreciated! To take things a step further, it would be great to create a dynamic ranking based upon filter selections like Date, Product Category, Etc.
This did not seem to work for me as several SKUs produced a ranking of 1 despite having different totals of pageviews.
Hi @Anonymous ,
Here are the steps you can follow:
Measure:
Rank_Meausure =
RANKX(FILTER(ALL('Table'),[Date]=MAX('Table'[Date])),CALCULATE(SUM([Page Views])),,DESC)
Calculated column:
Rank_Column =
RANKX(FILTER(ALL('Table'),[Date]=EARLIER('Table'[Date])),[Page Views],,DESC)
Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 55 | |
| 34 | |
| 31 | |
| 19 | |
| 17 |
| User | Count |
|---|---|
| 74 | |
| 71 | |
| 38 | |
| 35 | |
| 25 |