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
rintoalappat
Frequent Visitor

Top N Legend on a Time series Line chart with field parameter

Hi all,

 

I'm having a difficult time to show Top 5 Legend based on a Year-Month Trend Chart with a Field Parameter.

 

Data I have :

Field Parameter : Dim 

             Values (Region , Customer)

Slicers : Market, Segment, Category

Line Graph : Year Month on X-axis 

Sum of Sales on Y-axis

Field Parameter on Legend

 

Expectation :

1, Showing Top 5 based on "Profit" when selecting Field Parameter "Customer", should show everything when selecting "Region". 

 Note : on line graph, we are ploting "Sales" measure but Top N needs to find based on "Profit"

2, Slicers should affect the top 5

3, For below selection line should show trend of "first 5 people from the table"

 

rintoalappat_0-1706855417146.png

 

Download the above PBIX file : Click Here

 

Appreciate if someone crack this fast as we are having a PBI Migration. 

 

Regards,

Rinto

3 REPLIES 3
v-xuxinyi-msft
Community Support
Community Support

Hi @rintoalappat 

 

I'm sorry I can't open your link. If your problem hasn't been solved yet, please provide detailed sample data:  How to provide sample data in the Power BI Forum - Microsoft Fabric Community . Or show it as a screenshot. Please remove any sensitive data in advance. 

 

Best Regards,
Community Support Team _Yuliax

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

 

amitchandak
Super User
Super User

@rintoalappat , Create region sale

Region sales = calculate(sum(Orders[Sales]), Filter(ALLSELECTED(Orders), Orders[Region]= max(Orders[Region])))

 

Then use this measure in visual

Switch Sales = var _selected = maxx(FILTER('Select Dim', 'Select Dim'[Select Dim Order] = SELECTEDVALUE('Select Dim'[Select Dim Order])), 'Select Dim'[Select Dim])
return
Switch( _selected,
"Customer", sum(Orders[Sales]),
"Region",CALCULATE(Sum(Orders[Sales]), KEEPFILTERS(TOPN(5, ALLSELECTED(Orders[Region]),[Region sales],DESC))))

amitchandak_0-1706857199594.png



File is attached



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

Thank you and appreciate you time on this solution. 

 

I was trying and found there are few more steps: (please check the highlighted)

 

1, Showing Top 5 based on "Profit" when selecting Field Parameter "Customer", should show everything when selecting "Region". 

 Note : on line graph, we are showing "Sales" measure but Top N needs to find based on "Profit"

 

I missed to enter this in my first post.  Could you please try with this modification and let me know. Thanks in advance

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!

November Carousel

Fabric Community Update - November 2024

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

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.