Forum Discussion

dataconsole's avatar
dataconsole
Frequent Visitor
3 years ago

TOP N Formula as TOP N integrated filter

Dear members,

 

Is it possible to write a formula with TOPN that works the same way than integrated TOPN Filter in the Filter Pane ?

 

- When i use the Filter Pane with TOP N, it's possible to show only names of customers (i.e one field only selected in the table) without displaying the sorting value

 

 

- When i use a formula i need to have at least two fieds (name + TOP N measure for the sorted value)


 
Thank you !

 

4 Replies

  • Mikelytics's avatar
    Mikelytics
    Icon for Resident Rockstar rankResident Rockstar

    Hi dataconsole 

     

    The easiest way to achieve it is a following (with a small workaround) :).

     

    Turn off wrap fpr values and column headers:

     

    now you can make the sorting column smaller so that it is hidden:

     

     

     

    Does this solve your problem?

     

    Best regards
    Michael
    -----------------------------------------------------
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
    Appreciate your thumbs up!
    @ me in replies or I'll lose your thread.

     

     

     

     

     

     

     

     

     

     

  • dataconsole's avatar
    dataconsole
    Frequent Visitor

    Hi Mikelytics 

     

    as i said i was searching for the formula which was achieving the same result than the TOPN function from filter pane.

     

    Thanks for the workaround though 

    • Mikelytics's avatar
      Mikelytics
      Icon for Resident Rockstar rankResident Rockstar

      Hi dataconsole 

       

      Please find below the formula:

       

      Top10 Customers = 
      TOPN(
         10,
         ALL(Table),
         [Expression] 
      )

       

       

      This formula gives back the top 10 but you wont be able to put it in a visual because visuals can not give back calculated tables.

       

      Please find more infromation under:

      TOPN function (DAX) - DAX | Microsoft Learn

       

      Best regards
      Michael
      -----------------------------------------------------
      If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
      Appreciate your thumbs up!
      @ me in replies or I'll lose your thread.

  • ppm1's avatar
    ppm1
    Icon for Solution Sage rankSolution Sage

    The closest thing I could think of would be to write a measure that does CONCATENATEX of your TOPN, using a carriage return as the delimiter ( CHAR(10) ). You could then put that in a card (or a table with a single row).

     

    Pat