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
glaso-is
Frequent Visitor

Top N - Filtered table

Hi,

I was trying to create a new table from another one dynamically from a filtered table taking only the top 2, but it is not working properly when the table is filtered because the formula TOPN is always taking the whole set of data instead of using the filtered subset.

 

Here the formula to calculate the top 2 from the related transport.

 

FilterTable -Top2 = TOPN(2; RELATEDTABLE(Transports);[Sort];ASC)

If I don't apply any filter, it is working properly because it is taking the whole dataset. But, when I select Peter, I would like to get the top 2 from the filtered subset (Boat, Airplane) and not the top 2 from the whole subset (Bike, Car).
Captura1.PNGCaptura2.PNGCaptura3.PNG

 

 

Any idea or workaround in order to achieve the correct behavior?

Thanks. 

1 REPLY 1
v-yuezhe-msft
Employee
Employee

@glaso-is,

Please check my DAX in the following PBIX file.

https://1drv.ms/u/s!AhsotbnGu1NokypOsLp_hVARMuxQ

Regards,
Lydia

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

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.