Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

TOPN with Filters

Hey all,
 
I'm trying to create a measure or table column (table column preferred I think) using TOPN. I'm new to PowerBI so may be thinking of this incorrectly, but looking for some help.
 
I'm working on a fantasy football tool and have one table named 'Franchises' with a list of Franchises in a league (this is dynamic based on the league I'm looking at so can range from 8 to 96 values, but let's go with 12, which is most common). I then have another table named 'Players' that includes a column named 'Franchise' that matches and has a relationship with the 'Franchises' table, then I want to leverage the 'Position' and 'Value' columns in this 'Players' table.
 
I've been able to find the Total Value of each Franchise by Position by using this formula in a custom column:
 
QB Total Value = CALCULATE(SUM(Players[Value (PPR)]),FILTER(Players,Players[Franchise]=Franchises[name]&&Players[position]="QB"))
 
but now I want to ONLY find the Sum of the TOP N values of each Franchise by Position. How can I add a TOP N into this formula?
  • Hi Anonymous ,

     

    Hope these posts could help you:

    Calculating SUM of TOPN rows;

    Sum of Top3 Values.

     

    If they can't help you, please share me some sample data, not real data, for test.

     

     

    Best Regards,

    Icey

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

6 Replies

  • Anonymous hope this post can help. 

     

    Would appreciate Kudos 🙂 if my solution helped. Ask anything Power BI. Book appointment for a free consultancy at https://www.perytus.com

     

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      parry2k , thanks but I'm not interested in the visuals. I want either measures or calculated columns. I essentially want to do an Excel SUMIF with two criteria. So SUMIF of the "Value" column IF Franchise = Franchise && Position = "QB"

      • parry2k's avatar
        parry2k
        Super User

        Anonymous that post talks about how to achieve what you wnt, visualization is to just to show the result, not sure if you spend time to go through it.

  • Icey's avatar
    Icey
    Community Support

    Hi Anonymous ,

     

    Hope these posts could help you:

    Calculating SUM of TOPN rows;

    Sum of Top3 Values.

     

    If they can't help you, please share me some sample data, not real data, for test.

     

     

    Best Regards,

    Icey

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.