Formula app doesn't work in the first entry

Hi, I am experiencing the following problem:

I want to calculate the total hours worked per week in my timesheet.

In the column of total hours/week I put the following formula in the app:

SUM(SELECT(Timesheet[Total Hours],[Settimana num]=[Week Num])).

This formula is running in the spreadsheet only from the second entry. In the first entry, the result is 00:00:00 even if total hours are 08:00:00.

Is someone able to help? Maybe is the formula wrong? 

I also tried to put the inizial value, but nothing, it doesn't work.

Thanks a lot

Serena 

0 6 154
6 REPLIES 6

Steve
Platinum 5
Platinum 5

When you're in the form view of a new row, the new row doesn't yet exist in the table--it won't exist in the table until the form is saved. Your SELECT() expression is gathering the Total Hours values of the Timesheet table from rows that already exist in the table--which doesn't yet include the new row you are editing but haven't yet saved.

Hi Steve, got it.

So, do you have any suggestion to solve this matter? 

I need that that value shows up from the first entry.

Should I change the formula?

Thanks in advance for your kind reply

Serena 

Try this:

(
  SUM(
    SELECT(
      Timesheet[Total Hours],
      AND(
        ([Settimana num] = [Week Num]),
        ([_THISROW].[_RowNumber] <> [_RowNumber])
      )
    )
  )
  + [Total Hours]
)

([_THISROW].[_RowNumber] <> [_RowNumber]) excludes this row from the sum in case you're editing a previously-saved row. + [Total Hours] then adds this row's value.

Hi Steve, I tried to use the first formula, but still the result is not correct when I change the week number.

When I register the time in and time out for week number 44 (for example), the value should be the total hours of week 44 ....

Thanks for your kind help

Serena 

This is a new requirement that you have not described, so I have no information to go on.

Hi Steve,

 

I am so sorry of I did not explain well my issue with formula.

just, I need to calculate through the app the total Hours worked in a week, but not just one week, of all the weeks. At the end there will be a monthly Hour calculation , but I need the weekly count because the extra Hours are calculated on the weekly basis. 
I ma not sure that this will be possible through appasheets. 
min any case , Thank you for your and your team kind support.

serena 

Top Labels in this Space