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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

How to add a column to indicate max 10 for each group

Hei,

 

I have a table like this in Query Editor. Now I want to add a new column to indicate that this row is the latest 10 in each group of Value1. In other words, I want to find, for each A, B and C in Value1, the lastest 10 rows while latest 10 is defined by DateOfReport. I know how to do it if I only want the latest, but now I want the latest 10........ Thanks in advance!

 

Value1DateOfReportValue2Value3Value4Value5
A3/11/20200.3764594.5321910.5148581.317926
A3/11/20200.9395876.1786690.0546572.015988
A3/11/20206.3971957.3904571.6286251.611496
A3/11/20203.4490588.5578730.2852347.178153
A3/11/20203.3791244.3417418.1026467.96348
A3/11/20202.2094572.1917027.4780762.195619
A2/18/20204.1241332.1040148.4154380.162648
A2/18/20205.2260126.1824817.0171382.128309
B2/18/20202.0726180.4995546.8934570.571343
B2/18/20203.4055493.2923175.1388282.804114
B2/18/20204.5620766.8176839.5607319.90175
B3/12/20207.0255050.7142998.7008549.370493
B3/12/20205.4050355.6001599.4877182.259473
B3/12/20204.6169651.2699894.6267884.435011
B3/12/20209.9875486.4829547.5176483.506048
B3/12/20205.6062966.9695615.8372763.639896
B3/12/20203.5607982.0854651.1564444.981463
B3/16/20203.4735380.3316837.6169822.844292
B3/16/20206.2517461.0372058.589434.894561
B3/16/20204.9928364.6066787.387288.850803
B3/16/20206.9957050.6372510.790633.31176
B3/16/20201.858760.2180211.5100578.609189
B3/16/20200.7653087.7827573.9377274.046804
B2/25/20203.8279793.8350241.0355651.991558
C2/25/20205.6624647.7826896.3793184.408028
C2/25/20208.0636518.4112020.5172350.598607
C2/25/20209.3152344.6809019.6267027.988079
C2/25/20207.0309362.3493984.6634678.218761
C2/25/20201.3526254.6468013.388075.574083
C2/26/20203.1693675.7642536.8424590.905843
C2/26/20206.8533273.7140521.0041127.345359
C2/26/20203.2279436.6419824.3893736.046594
C2/26/20208.3022759.3471629.4721017.484054
1 ACCEPTED SOLUTION
v-diye-msft
Community Support
Community Support

Hi @amitchandak 

 

Kindly let me know if you'd like to get this one:

Then filter the column no more than 10

 

 

Column = var a = 'Table'[Value1]
Return
RANKX(FILTER('Table',[Value1]=a),'Table'[DateOfReport],,ASC)

 

 

4.PNG 

Community Support Team _ Dina Ye
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

7 REPLIES 7
v-diye-msft
Community Support
Community Support

Hi @amitchandak 

 

Kindly let me know if you'd like to get this one:

Then filter the column no more than 10

 

 

Column = var a = 'Table'[Value1]
Return
RANKX(FILTER('Table',[Value1]=a),'Table'[DateOfReport],,ASC)

 

 

4.PNG 

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.
Anonymous
Not applicable

Thanks, but i have already accepted a previous answer as solution and cant accept another... 

amitchandak
Super User
Super User

Try if this can help

For Rank Refer these links
https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures
https://radacad.com/how-to-use-rankx-in-dax-part-1-of-3-calculated-columns
https://radacad.com/how-to-use-rankx-in-dax-part-3-of-3-the-finale

 

Can you give example of output

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
Anonymous
Not applicable

This works and I have accepted it as solution... 🙂

Anonymous
Not applicable

Hi,

 

Thanks for tips. But I am not quite sure this will work. Ranking is a good idea, but I need to rank by Value1 and this Value1 might have many many values that make it hard to list them manually...

AilleryO
Memorable Member
Memorable Member

Hi,

 

Can a filter on Value1, using a TOP N filter based on date, be usefull ?

Select your table and column Value1 and use filter panel to create a TOP N filter.

Choose your date and a Max function for the value of your TOP N.

Is that of any help ?

Anonymous
Not applicable

Sorry... not really... i need a column in Query Editor...

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.

Top Solution Authors