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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register 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



Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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