Measure group hours by week

Here is my PBIX file and solution file example:

I have people with hours worked for each day. I want to group by week (ending Friday and starting Saturday) then sum hours for each person. See column D for solution example:

This measure isn’t summing how I expected and the output isn’t right. What is best way to do this?

hi @izzleee,

Made some small changes to your measure, give this a go:

sum_weekhrs v2 = 
    var selperson = VALUES('sample'[person])
    VAR startOfWeek = VALUES( Dates[WeekStartingSaturday] )

    var result = 
    CALCULATE(
        SUM('sample'[hrs]),
        'sample'[person] IN selperson,
        'Dates'[WeekStartingSaturday] IN startOfWeek, 
        REMOVEFILTERS( Dates[Date] ), REMOVEFILTERS( 'sample'[hrs] )
    )
    return result

.
With this result

image

Note you don’t need REMOVEFILTERS( ‘sample’[hrs] ) if you remove that field from the table visual.

I hope this is helpful

2 Likes

Thanks @Melissa ! You seem to know everything. Always really appreciate your answers.