Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I had two rather complex formulas for the calculation of workdays_so_far_this_year (Mo-Fri) and days_so_far_this_year (Mo-Sun).
They were
- SUM({1<%Datum = {">=$(=makedate(year(today()), 1, 1))<$(=DATE(v_today_num))" }>} Werktag) [for workdays]
(where >Werktag< is a binary field - 1 for (Mo-Fri), 0 for (Sat-Sun)
- COUNT({1<%Datum = {">=$(=makedate(year(today()), 1, 1))<$(=DATE(v_today_num))" }>} Werktag) [for days]
Someone (sorry, it was offhand, so I didn't remember clearly) told me here on the forum how I could calculate the workdays_YTD much easier:
=> floor(reloadtime()) - yearstart(reloadtime()) - that works fine because the app is reloaded daily.
=> Is there also a way I can simplify the other formula, too? I'm sure that would result in a performance win, however small, as these formulas are present in every one of my apps.
Thanks a lot!
Best regards,
DataNibbler
P.S.: Ceterum censeo - there should be, among others, a category for posts rgd. variables to make those easier discernable.
Hi
How about:
NetWorkDays(YearStart(Today()), Today())
Regards
Jonathan
PS: replace Today() with reload time or variable as required
Hi
How about:
NetWorkDays(YearStart(Today()), Today())
Regards
Jonathan
PS: replace Today() with reload time or variable as required
Hi Jonathan,
bull's_eye 😉 That's going to work.
I will put those two variables in a qvs file - they are needed in every app...