Forum Discussion

lastnn30's avatar
lastnn30
Post Patron
4 years ago
Solved

Is Top N only for text fields?

Hi

I have this dataset (please see attached screenshot) but when I go to Filter-->Salary I do not see the Top N option. But When I go to Name field, I see Top N option, why is that? Thank you very much.

 

  • Because that's the normal behaviour of Power BI. You want to list the Employees Names based on their salaries and not the salaries based on the Employees Names :

     

     

     

    Result : 

     

     

    It is similar for example in T-SQL : 

     

    SELECT TOP 10 employee, salary FROM yourtable

     ORDER BY salary DESC;

     

    The value to be added in By Value is the one that we ORDER BY in SQL

3 Replies

  • amirabedhiafi's avatar
    amirabedhiafi
    Impactful Individual

    You can specify that you’d like to filter by the Top or Bottom of the salary You will find the Ton N filter in the filter pane as a Filter Type option for the Name field you want to filter down. It like you are displaying the Name of the TOP X salaries and not vice versa.

     

    Here is an example :

     

     

     

    So this filter is for Name column, not for Salary column. In your scenario, you can proceed like below : 

    in Show items :  TOP 3

    and in the by value : you add the data field Salary

    • lastnn30's avatar
      lastnn30
      Post Patron

      Thank you very much for your reply. But I want to know why the Salary field in my case does not have the Top N option! That is what I do not get it. Thanks once again.

      • amirabedhiafi's avatar
        amirabedhiafi
        Impactful Individual

        Because that's the normal behaviour of Power BI. You want to list the Employees Names based on their salaries and not the salaries based on the Employees Names :

         

         

         

        Result : 

         

         

        It is similar for example in T-SQL : 

         

        SELECT TOP 10 employee, salary FROM yourtable

         ORDER BY salary DESC;

         

        The value to be added in By Value is the one that we ORDER BY in SQL