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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Lkingdom
Frequent Visitor

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 @Lkingdom ,

 

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 @Lkingdom ,

 

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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