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
rsbin
Super User
Super User

Dynamic Top N: Facility / Employee / Overtime Hours

Good Afternoon All,

I am creating a dynamic Top N report to capture Overtime Hours by Employee at different facilities.

I have the following Slicers:  PayWeek, Facility, and my Top N Selector.

rsbin_1-1601493429745.png

 

I am not sure how to proceed at this point.  Based on the Slicer Selections, I need to populate a bar chart.

Daily data is stored in a Fact table called OTStats. 

For each Employee, I will need to Sum OT Hours for each day of the PayWeek selected (multiple weeks are allowed).

 

rsbin_0-1601492834067.png

I think I need to create some sort of table (virtual or actual), but am stuck.  Any guidance would be very much appreciated.

1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

@rsbin 

I am assuming you have a measure to sum the OT Hours, in my example that is [OT Hours].  Then you would use something like this:

Top N OT Employees = 
VAR _SelectedN =
    SELECTEDVALUE ( 'Select Top N'[Top N Value], 10 )
RETURN
    CALCULATE (
        [OT Hours],
        KEEPFILTERS( TOPN ( _SelectedN, ALL ( 'YourTable'[Employee Name] ), [OT Hours] ) )
    )

View solution in original post

2 REPLIES 2
jdbuchanan71
Super User
Super User

@rsbin 

I am assuming you have a measure to sum the OT Hours, in my example that is [OT Hours].  Then you would use something like this:

Top N OT Employees = 
VAR _SelectedN =
    SELECTEDVALUE ( 'Select Top N'[Top N Value], 10 )
RETURN
    CALCULATE (
        [OT Hours],
        KEEPFILTERS( TOPN ( _SelectedN, ALL ( 'YourTable'[Employee Name] ), [OT Hours] ) )
    )

Hello @jdbuchanan71 ,

 

Thank You for the quick response!

Pretty sure that looks like the answer I was looking for!

 

Thanks again and of course Kudos to you.

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.