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
Juramirez
Resolver I
Resolver I

Top 10 or Top all not working as expected

Hi all 

 

I'm having these formulas to show Top10/ Top all: 

 

Top= RANKX(FILTER ( ALL ( 'Table A ), 'Table A'[FilteredField] = "6" ),[AMOUNT],,DESC)

 

Top/All = IF([Top]<=10,"Top 10","All")

 

 

When I select top all it shows all values ignoring the condition of the filter (in this case it shows top 10 values when FilteredField is equal to 6 but when selecting all, it shows values with FilteredField equal to 1,2,3,...)

 

What i'm doing wrong here?

 

Regards

J.

1 ACCEPTED SOLUTION

Hi @Juramirez,

 

Please try below measures:

sum amount =
CALCULATE (
    SUM ( Table1[Amount] ),
    FILTER ( Table1, Table1[ParameterToFilter] = 6 )
)

Rank = RANKX(ALLSELECTED(Table1),[sum amount],,DESC,Dense)

flag = IF(SELECTEDVALUE(Table2[Selection])="All",1,IF([Rank]<=5,1,0))

Table2 is an extra table generated manually which provides slicer selection. Column [ParameterToFilter] and measure [flag] should be added to visual level filters.

 

For details, please refer to the attached .pbix file.

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
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

6 REPLIES 6
v-yulgu-msft
Employee
Employee

Hi @Juramirez,

 

Have you tried this?

Top/All = IF(RANKX(FILTER ( ALL ( 'Table A ), 'Table A'[FilteredField] = "6" ),[AMOUNT],,DESC)<=10,"Top 10","All")

 

What do you mean "select top all"? Select from a slicer? Please provide some sample data and show us your desired output.

 

Regards,

Yuliana Gu

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

Hi @v-yulgu-msft

 

Here you can see sample data

What I want is to filter all data by column ParameterToFilter=6. Then I want to show a top 10 of these filtered values that have the higher Amount but i want to have a Slicer which allows me to show All (not just top 10) values that meet this filter. 

 

Regards

Julian

Anonymous
Not applicable

Where is the excel file?

I just update the post. It's in Google Drive.

Any update about this? 

Any help is appreciated.

 

Regards,

J.

Hi @Juramirez,

 

Please try below measures:

sum amount =
CALCULATE (
    SUM ( Table1[Amount] ),
    FILTER ( Table1, Table1[ParameterToFilter] = 6 )
)

Rank = RANKX(ALLSELECTED(Table1),[sum amount],,DESC,Dense)

flag = IF(SELECTEDVALUE(Table2[Selection])="All",1,IF([Rank]<=5,1,0))

Table2 is an extra table generated manually which provides slicer selection. Column [ParameterToFilter] and measure [flag] should be added to visual level filters.

 

For details, please refer to the attached .pbix file.

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
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.