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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Top N with dynamic start and end point

Hi I am quite new to Power BI

 

I have an extensive range of data which I would like to look at the Top N with a dynamic start and end.

For example,

Item Name          Stock             6 Month Sales

Item 1                     100               500

Item 2                     2000            600

Item 3                     5                     15

...

Item 4000            100               500

Item 4001            100               500

But I would like to start at Item 1001 compared to item 1

Item Name          Stock             6 Month Sales

Item 1000            100               510

Item 1001            110               511

Item 1002            111               500

Item 1003            112               510

...

Item 3000            100               500

Item 3000            100               500

Is this possible? And would I be able to actively change this depending on needs

1 ACCEPTED SOLUTION
V-lianl-msft
Community Support
Community Support

Hi @Anonymous ,

 

You can split the item number into a new column in power query and use it as a slicer to limit the start and end range.

test_split.PNG

Create an unrelated number table as the top n slicer.

Table 2 = GENERATESERIES(1,50,1)

Then create a measure and apply it in visual level filter.

Measure = IF(RANKX ( 
            ALLSELECTED('Table'),
           [sum_sales]
        )<=SELECTEDVALUE('Table 2'[rank]),
        1,0)

test_Dynamic_topn.PNG

Sample .pbix 

 

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

View solution in original post

2 REPLIES 2
V-lianl-msft
Community Support
Community Support

Hi @Anonymous ,

 

You can split the item number into a new column in power query and use it as a slicer to limit the start and end range.

test_split.PNG

Create an unrelated number table as the top n slicer.

Table 2 = GENERATESERIES(1,50,1)

Then create a measure and apply it in visual level filter.

Measure = IF(RANKX ( 
            ALLSELECTED('Table'),
           [sum_sales]
        )<=SELECTEDVALUE('Table 2'[rank]),
        1,0)

test_Dynamic_topn.PNG

Sample .pbix 

 

Best Regards,
Liang
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

@Anonymous , Not very clear. Do you want to filter items or rank. See if this can help

https://community.powerbi.com/t5/Community-Blog/Dynamic-TopN-made-easy-with-What-If-Parameter/ba-p/367415

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Users online (2,794)