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

TopN filter returning more than requested

 

 

I have a table where I am requesting the last 10 items completed by date.  In my dataset there can be more than one item completed on a single day.  This is causing my TopN filter to return the incorrect number of values.   In this instance I have requested 10 but am getting 14 due to 4 items being completed on the same day as another.

14 Responses14 ResponsesFilterFilter

1 ACCEPTED SOLUTION
d_gosbell
Super User
Super User

This is because you are filtering the response date column. So you are asking Power BI to give you a list of 10 dates and then it filteres the table by that.

 

If you want just 10 rows of data you would need to apply your filter to some unique column like a responseID that has a different value in each row. You would still use the same condition (top 10 by Latest Response Date) just change the column that you are filtering.

View solution in original post

3 REPLIES 3
v-lid-msft
Community Support
Community Support

Hi @Anonymous ,

 

TopN() returns top N rows based on the Response Date. However if the Response Date has same values, those rows will be retrieved. If you do not want to get the same date, we can use the rankx function, create a table using the following DAX.

 

FilterTable = 
VAR t =
    ADDCOLUMNS (
        'Table',
        "r", RANKX ( ALL ( 'Table' ), 'Table'[Response Date],, ASC )
    )
VAR result =
    FILTER ( t, [r] <= 10 )
RETURN
    SELECTCOLUMNS (
        result,
        "Name", [Name],
        "Response Date", [Response Date],
        "Cycle Time", [Cycle Time]
    )

TopN-filter-returning-more-than-N-requested-1.pngTopN-filter-returning-more-than-N-requested-2.png

 

BTW, pbix as attached.

 

Community Support Team _ DongLi
If this post helps, then please consider Accept it as the solution to help the other members find it more 

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
d_gosbell
Super User
Super User

This is because you are filtering the response date column. So you are asking Power BI to give you a list of 10 dates and then it filteres the table by that.

 

If you want just 10 rows of data you would need to apply your filter to some unique column like a responseID that has a different value in each row. You would still use the same condition (top 10 by Latest Response Date) just change the column that you are filtering.

RP7_0-1647359134267.png 

RP7_1-1647359199887.png

Hi Guys,

 

The above graph has been filtered to TOP 5 by DPV (line). However, its showing top 6 because the last 2 categories (Fixing Missing, Incomplete) have the same DPV value (3.0). Is there any way I can only show Top 5 please? I don't have any columns that have unique values.

 

Thanks,

Ram

 

 

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