Sum total of a duration for a given period

Hello,

i am working on a timesheet app. I got everything to work but my employees are asking me if they can have the sum of their working hours for the last three weeks displayed. I am really clueless of how i can pull this one.

Solved Solved
0 16 3,176
1 ACCEPTED SOLUTION

For last week, try:

SUM(
  SELECT(
    table[Duration],
    AND(
      (USEREMAIL() = [email]),
      ([date] >= (TODAY() - WEEKDAY(TODAY()) - 7)),
      ([date] < (TODAY() - WEEKDAY(TODAY())))
    )
  )
)

For the week before that:

SUM(
  SELECT(
    table[Duration],
    AND(
      (USEREMAIL() = [email]),
      ([date] >= (TODAY() - WEEKDAY(TODAY()) - 14)),
      ([date] < (TODAY() - WEEKDAY(TODAY())) - 7)
    )
  )
)

For this week so far:

SUM(
  SELECT(
    table[Duration],
    AND(
      (USEREMAIL() = [email]),
      ([date] >= (TODAY() - WEEKDAY(TODAY())))
    )
  )
)

View solution in original post

16 REPLIES 16
Top Labels in this Space