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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch 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
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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.