Forum Discussion

NumeroENAP's avatar
NumeroENAP
Icon for Helper III rankHelper III
6 years ago
Solved

TOPN by city

Hi, 

 

I'm having problem with the use of TOPN, for some reason. 

 

Here is an exemple of my model : 

EmployeCity%
JohnBuffalo40%
JuliaBuffalo38%
PedroSan Jose38%
CareySan Jose18%

 

I want a measure that would give me only the top performer (%) by city.

 

Thanks

  • NumeroENAP's avatar
    NumeroENAP
    6 years ago

    I succeeded! I used that formula : 

     

    TOP2RANK = CALCULATE(
           SUM('Table'[%]
                        );
                 TOPN(2;'Table';'Table[created_index];DESC
           )
    )
     
    Of course, I sorted my table with Power Query first.

8 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Go to Filter pane

    click on city column and Select Filter type as top N

    And and click on top and type 1 and then add measure(in your case % measure) by which you want top N.

     

    Thanks & regards,
    Pravin Wattamwar
    www.linkedin.com/in/pravin-p-wattamwar

    If I resolve your problem Mark it as a solution and give kudos.

    • NumeroENAP's avatar
      NumeroENAP
      Icon for Helper III rankHelper III

      For some reasons, it gives me the top 2 employees of 2 random cities (out of 22). However, I made a % measure (with DIVIDE) and inserted it in the TOPN (filter/TOP N | 2 / by value). 

      • Anonymous's avatar
        Anonymous
        Not applicable
        Can you share the sample data and what output you are getting when you click on top N.
  • az38's avatar
    az38
    Icon for Community Champion rankCommunity Champion

    Hi NumeroENAP 

    try new calculated table

     

    Table 2 = 
    ADDCOLUMNS(
    SUMMARIZE('Table';'Table'[City];"%";MAX('Table'[%]));
    "Employee";
    LOOKUPVALUE('Table'[Employe];'Table'[City];[City];'Table'[%];[%])
    )

    do not hesitate to give a kudo to useful posts and mark solutions as solution

    LinkedIn