sum expression different result

hello everyone;

i am making a program that calculates the annual leave of employees. But i ran into a problem which is;

KAZANILAN_IZIN = annual leave earned

KULLANILAN_IZIN = annual leave used 

KALAN_IZIN = remaining annual leave

data1.png

 

data.png

formula is used in the same table

sum.png

the formula = annual leave earned - sum of the previous annual leaves used - leave used in this form(number of between two dates)

dates = start date , end date

uygulama.png

= 120 - sum of the previous annual leaves used - 1 = 119 >> this is true result but;

desktop.png

= 120 - sum of the previous annual leaves used - 1 = 118 >> this is false result 

when i looking tablet mode result is true;

when i looking desktop mode result is false

same formula but different result

how can i fix it ?

 

0 10 275
10 REPLIES 10

anyone help

I suggest to rewrite your formula to use hours instead of days, and in the end divide the hours by 24

Date1 -Date2 gives a Duration result

https://support.google.com/appsheet/answer/10107326?hl=en

Screenshot_20230112-225416.png

 edit : one of my apps formula , but it takes into account multiple things, like weekend days, national holidays , non approved leaves..

If([aprobat]="nu";0;HOUR([DataConcFinal]-[DataConcStart])/24 +1 -(2*(weeknum([DataConcFinal])-weeknum([DataConcStart])+1) - ( ifs(weekday([DataConcStart])<>1;1)+ ifs(weekday([DataConcFinal])<>7;1) ))-count(select(libera nat[ziua cal];and([ziua cal]>=[DataConcStart];[ziua cal]<=[DataConcFinal];weekday([ziua cal])<>1;weekday([ziua cal])<>7);true)))

 

It could be that in the Desktop mode, SELECT is pulling different rows (could be including the row in the current form) than those pulled in the current mode (what is in the google sheet before sync).

Try displaying the result of the SELECT statement and see what is happening.

how can i use SELECT statement in this stuation ?

I meant whatever you have behind sum of the previous annual leaves used

the problem is that it calculates the current used leave in the annual leave form twice in desktop mode. accepts the sum of the previous used permissions as if the used permission on the linked form existed before.

Create virtual columns in table, and put parts of your formula (or all the formula) in these virtual columns...for testing purposes only, to see where are the diferences. 

the formula is

FLOOR(HOUR([enddate]-[startdate])/24)

but still wrong

Steve
Platinum 4
Platinum 4

Desktop View is currently a preview feature and under active development. Preview features are not yet suitable for use in important apps. Until it has achieved greater stability, I recommend against using this preview feature except for testing and to help the AppSheet developers in their efforts. To follow the progress of and contribute to the development effort, please visit this dedicated Community topic:

In Preview: New UI design for desktop users

Top Labels in this Space