Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
tracyhopaulson
Resolver I
Resolver I

Top N Ranking for specific year

I have a list of customers and need to rank by 2021 sales.  When using Top N function, it ranks by total sales of all years.  Is there a work around to rank sales for specific year?  Thanks

 

 

ranking.JPG

 

 

 

 

1 ACCEPTED SOLUTION
TheoC
Super User
Super User

Hi @tracyhopaulson, you can create a rank by category through a Calculated Column that will provide you with a ranking for each Customer by their respective Total Value for each Year.  You can then simply filter out Year column to 2021 by "Fitler Type" in the Filters Pane of the visual.  Hope this helps 🙂 (FYI - I called the table "t_Rank" so you will need to adjust yours accordingly 🙂 )

 

TheoC_0-1633581389736.png

Also, an alternative is to use a Slicer / Filter visual with Years so that you can let the user choose the Year and show the rank accordingly 🙂

TheoC_1-1633581479078.png

 

Just in addition to the above, I recently put together a solution for dynamic ranking for visuals. This may be of benefit to you as well: https://community.powerbi.com/t5/Desktop/Sort-Legend-Dynamically-By-its-Value/m-p/2112139#M782542

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

View solution in original post

4 REPLIES 4
DavidLibrando23
New Member

Question with regards to this. What if multiple Selection for year is filltered? how to Top N dynamically?

TheoC
Super User
Super User

Hi @tracyhopaulson, you can create a rank by category through a Calculated Column that will provide you with a ranking for each Customer by their respective Total Value for each Year.  You can then simply filter out Year column to 2021 by "Fitler Type" in the Filters Pane of the visual.  Hope this helps 🙂 (FYI - I called the table "t_Rank" so you will need to adjust yours accordingly 🙂 )

 

TheoC_0-1633581389736.png

Also, an alternative is to use a Slicer / Filter visual with Years so that you can let the user choose the Year and show the rank accordingly 🙂

TheoC_1-1633581479078.png

 

Just in addition to the above, I recently put together a solution for dynamic ranking for visuals. This may be of benefit to you as well: https://community.powerbi.com/t5/Desktop/Sort-Legend-Dynamically-By-its-Value/m-p/2112139#M782542

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

Thank you 🙂

amitchandak
Super User
Super User

@tracyhopaulson , create a measure like this and create rank on that

meausre = calculate(sum(Table[sales]),Table[Year]=2021)

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.