Forum Discussion

k-linerz's avatar
k-linerz
New Member
4 years ago
Solved

Dynamic Top N

Hello, Ive got data in power BI pulled from SQL. Columns are : Date, SiteName, PersonName, SalesNumber, What I want to do is have a table to show the Date and then in that show the top 5 PersonName ...
  • v-zhangti's avatar
    4 years ago

    Hi, k-linerz 

     

    You can try the following methods.

    Measure = 
    Var _Top5=TOPN(5,ALLSELECTED('Table'[Name]),CALCULATE(SUM('Table'[Sales])),DESC)
    Var _name=SELECTEDVALUE('Table'[Name])
    Return 
    IF(_name in _Top5,1,0)

    Put Measure in the Filter of the view and set it equal to 1.

    Please see the attachment for details.

     

    Best Regards,

    Community Support Team _Charlotte

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