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

Filter top N rows based on value not working as values are duplicated.

I have the following dataset.

 

CompanyRank  No
ABC10A1
PQR10A2
LIE10A3
IHUIG10A4
IU10A5
OI10A6
WHEFW10A7
SDBV10A8
UER10A9
WUIE10A10
WUIEF20B1
DIFO20B2
WERUI20B3
SIUDYF20B4
CNSJKD20B5
ISOEUF20B6
QIWUO20B7
SXCUYSI20B8
OWIERQ20B9
IFIHI20B10

 

I wanted to filter top 12 Companies based on Rank. As the data is connected using direct query (SQL database), I am unable to use Rank or any such dax. When I tried adding a top 12 filter for Company based on Rank, the table visual looks as below.

 

CompanyRank
ABC10
PQR10
LIE10
IHUIG10
IU10
OI10
WHEFW10
SDBV10
UER10
WUIE10
WUIEF20
DIFO20
WERUI20
SIUDYF20
CNSJKD20
ISOEUF20
QIWUO20
SXCUYSI20
OWIERQ20
IFIHI20

 

Any help would be very helpful. Thanks in advance !

3 REPLIES 3
v-yingjl
Community Support
Community Support

Hi @Anonymous ,

1. If the dataset is all of your data, perhaps you need to create a index column in the data source manually and use topN filter to filter bottom 12 fields like this:

index column.png

 

2. If the dataset has other fields and rank value, you can create a rank measure like this and use topN filter:

Measure = RANKX(ALL('Rank_table'),CALCULATE(SUM(Rank_table[Rank])),,ASC,Dense)

 top12.png

 

Here is my whole sample data table:

dq table.png

 

Best Regards,
Yingjie Li

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 applicable

Hi @amitchandak, Thanks alot for your help.

But since we are using direct query method to connect with the dataset, we are unable to use Rank function. 

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.