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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
AmandaHore
Regular Visitor

Help with summing values by week

I am working with an SQL database provided by a vendor to build some power BI reports.   So far it has been all good but now I need some help.  

I want to calculate the billable time that people have worked over a given week from their timesheet.  

The catch is that the User Timesheet Table does not have a date field, it only has a week start and week end.  

Fields are:

FACTUserTimesheet [WeekStart]

FACTUserTimesheet [Week End] and 

FACTUserTimesheet [Billableminutes]

 

We have a Date table that has date, the week number already added and FirstofWeek and LastofWeek values

Fields are

DIMDateExtended [Date]

DIMDateExtended [FirstofWeek]

DIMDateExtended [LastofWeek]

DIMDateExtended [Week]

 

I want to create a sum of the billable minutes for every week and the cumulative values in a table like below.  

 

WeekStart of WeekBillable MinutesBillable HoursCumulative Values
120/12/20244507.57.5
26/01/202570011.6719.17
313/01/20255008.3327.50
420/01/202562310.3837.88

 

I need help with the mesures for Billable Minutes, Billable Hours and Cumulative values based on the week.  

 

Any guidance is really appreciated as I am not that experienced with Dax and this is getting a bit beyond my skills. 

 

1 ACCEPTED SOLUTION
vicky_
Super User
Super User

Create a relationship between FACTUserTimesheet [WeekStart] and DIMDateExtended [FirstofWeek].

This allows for the filter context to come into use - see https://www.sqlbi.com/articles/filter-context-in-dax/

 

You can either use an Implicit Measures (drag FACTUserTimesheet [Billableminutes] to the data section and summarise by SUM), or a measure:

Billable Minutes = SUM(FACTUserTimesheet [Billableminutes])

see https://radacad.com/explicit-vs-implicit-dax-measures-in-power-bi if you're unsure on implicit vs explicit measures.

 

For Billable Hours, it would be best to use a measure:

Billable Minutes = DIVIDE(SUM(FACTUserTimesheet [Billableminutes]), 60)

And the easiest way to get the cumulative billable hours would be to use a visual calculation with the RUNNINGSUM() function- https://learn.microsoft.com/en-us/power-bi/transform-model/desktop-visual-calculations-overview

 

View solution in original post

1 REPLY 1
vicky_
Super User
Super User

Create a relationship between FACTUserTimesheet [WeekStart] and DIMDateExtended [FirstofWeek].

This allows for the filter context to come into use - see https://www.sqlbi.com/articles/filter-context-in-dax/

 

You can either use an Implicit Measures (drag FACTUserTimesheet [Billableminutes] to the data section and summarise by SUM), or a measure:

Billable Minutes = SUM(FACTUserTimesheet [Billableminutes])

see https://radacad.com/explicit-vs-implicit-dax-measures-in-power-bi if you're unsure on implicit vs explicit measures.

 

For Billable Hours, it would be best to use a measure:

Billable Minutes = DIVIDE(SUM(FACTUserTimesheet [Billableminutes]), 60)

And the easiest way to get the cumulative billable hours would be to use a visual calculation with the RUNNINGSUM() function- https://learn.microsoft.com/en-us/power-bi/transform-model/desktop-visual-calculations-overview

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 NL Carousel

Fabric Community Update - February 2025

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