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
dsmitha
Responsive Resident
Responsive Resident

top 5 and bottom 5

Hi,

 

Am trying to develop a dashboard which will show the top five sales and bottom five sales  detais using a column chart visual. 

I would like to add a measure instead of the filter options. Request your guidance to solve this issue

 

regards,

 

dsmitha

3 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@dsmitha , You can measures like ([Sales] is a measure)

 

TOP 5= Divide( CALCULATE([Sales],TOPN(5,all(Geography[City]),[Sales],DESC),VALUES(Geography[City]))

Botton 5 = Divide( CALCULATE([Sales],TOPN(5,all(Geography[City]),[Sales],DESC),VALUES(Geography[City]))

 

Combine = Divide( CALCULATE([Sales],TOPN(5,all(Geography[City]),[Sales],DESC),VALUES(Geography[City])) +

Divide( CALCULATE([Sales],TOPN(5,all(Geography[City]),[Sales],DESC),VALUES(Geography[City]))

 

 

Refer: https://youtu.be/QIVEFp-QiOk 

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

View solution in original post

Jihwan_Kim
Super User
Super User

Hi,

I like to suggest using TOPN DAX function with KEEPFILTERS DAX function.

I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file.

 

Untitled.png

 

Sales measure: = 
SUM( Data[Sales] )

 

Top five products: = 
CALCULATE (
    [Sales measure:],
    KEEPFILTERS ( TOPN ( 5, ALL ( Data ), [Sales measure:], DESC ) )
)

 

Bottom five products: = 
CALCULATE (
    [Sales measure:],
    KEEPFILTERS ( TOPN ( 5, ALL ( Data ), [Sales measure:], ASC ) )
)

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

View solution in original post

ribisht17
Super User
Super User

@dsmitha 

 

Using RANKX > Top and Bottom 10 Products by Sales Using RANKX in Power BI - YouTube

 

Using the Same Visual > Solved: How to display Top 5 and Bottom 5 in the single ch... - Microsoft Power BI Community

 

Regards,

Ritesh

Mark my post as a solution if it helped you| Munde and Kudis (Ladies and Gentlemen) I like your Kudos!! !!
My YT Channel Dancing With Data !! Connect on Linkedin !!Power BI for Tableau Users 

View solution in original post

6 REPLIES 6
ribisht17
Super User
Super User

@dsmitha 

 

Using RANKX > Top and Bottom 10 Products by Sales Using RANKX in Power BI - YouTube

 

Using the Same Visual > Solved: How to display Top 5 and Bottom 5 in the single ch... - Microsoft Power BI Community

 

Regards,

Ritesh

Mark my post as a solution if it helped you| Munde and Kudis (Ladies and Gentlemen) I like your Kudos!! !!
My YT Channel Dancing With Data !! Connect on Linkedin !!Power BI for Tableau Users 

dsmitha
Responsive Resident
Responsive Resident

Hi ribisht17,

 

thank you very much 

 

regards,

 

dsmitha

 

Jihwan_Kim
Super User
Super User

Hi,

I like to suggest using TOPN DAX function with KEEPFILTERS DAX function.

I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file.

 

Untitled.png

 

Sales measure: = 
SUM( Data[Sales] )

 

Top five products: = 
CALCULATE (
    [Sales measure:],
    KEEPFILTERS ( TOPN ( 5, ALL ( Data ), [Sales measure:], DESC ) )
)

 

Bottom five products: = 
CALCULATE (
    [Sales measure:],
    KEEPFILTERS ( TOPN ( 5, ALL ( Data ), [Sales measure:], ASC ) )
)

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

Hi Jihwan_Kim,

 

Thank you very much for your guidance, this helped a lot 

 

regards,

 

dsmitha

amitchandak
Super User
Super User

@dsmitha , You can measures like ([Sales] is a measure)

 

TOP 5= Divide( CALCULATE([Sales],TOPN(5,all(Geography[City]),[Sales],DESC),VALUES(Geography[City]))

Botton 5 = Divide( CALCULATE([Sales],TOPN(5,all(Geography[City]),[Sales],DESC),VALUES(Geography[City]))

 

Combine = Divide( CALCULATE([Sales],TOPN(5,all(Geography[City]),[Sales],DESC),VALUES(Geography[City])) +

Divide( CALCULATE([Sales],TOPN(5,all(Geography[City]),[Sales],DESC),VALUES(Geography[City]))

 

 

Refer: https://youtu.be/QIVEFp-QiOk 

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

Hi amitchandak,
Thanks a lot for your timely help
 
regards,
dsmitha
 

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.