Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
scottcolbourne
Regular Visitor

Creating a table that summarises records per week and with top performers

I need to create a visual or table like the following:

scottcolbourne_0-1613794838502.png

I have an activities table with multiple columns, including:

Date

Person

activityid

Plus a date table with week end dates in it linked to the above date.

 

Now it is easy to list number of activities per person, but to show the TOP N, only works on the total, not on each week's totals.

 

To get a table to similar to above:

Do I need a summary table?

Also how do you list multiple people on one line?

Any ideas would be great for how I can get the top 3 for each given week.

1 ACCEPTED SOLUTION
mahoneypat
Employee
Employee

You can use TOPN and CONCATENATEX to get your result.  For example,

 

Top Performers =
VAR vTop3 =
    TOPN (
        3,
        VALUES ( Table[Person] ),
        CALCULATE (
            DISTINCTCOUNT ( Table[ActivityID] )
        )DESC
    )
RETURN
    CONCATENATEX (
        vTop3,
        Table[Person],
        ", "
    )

 

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

Share the raw dataset in a format that can be pasted in an Excel workbook.  Alternatively, share the link from where i can download your PBI file. 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
mahoneypat
Employee
Employee

You can use TOPN and CONCATENATEX to get your result.  For example,

 

Top Performers =
VAR vTop3 =
    TOPN (
        3,
        VALUES ( Table[Person] ),
        CALCULATE (
            DISTINCTCOUNT ( Table[ActivityID] )
        )DESC
    )
RETURN
    CONCATENATEX (
        vTop3,
        Table[Person],
        ", "
    )

 

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Thank you Pat - that is great.  Strangely though it does not list them in descending order of number of activities.  The top 3 are correct though.  Any ideas why it is not ordering them in the concatenation in the descending order?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.