Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
NetWorkDays are used to calculate the working date, but there are too much dates in recent 2 years.
For example, '2021-10-01','2021-10-02','2021-10-03','2021-10-04','2021-10-05','2021-10-06','2021-10-07','2021-12-24','2021-12-25','2022-01-01','2022-01-02','2021-01-03'......
Everytime I write the expression, I have to copy that long. It's not convenient.
Is it possible to create holiday variable containing all of these dates and add new holiday dates freely?
Hi @My_Rebecca, Yes, you can all these dates in the variable.
Try this
Inline_Holidays:
LOAD * INLINE [
PublicHolidays
'2021-10-01'
'2021-10-02'
'2021-10-03'
'2021-10-04'
'2021-10-05'
'2021-10-06'
'2021-10-07'
'2021-12-24'
'2021-12-25'
'2022-01-01'
'2022-01-02'
'2021-01-03'
];
TempHoliday:
Load
Concat(PublicHolidays,',') as Pub_Holidays
Resident Inline_Holidays;
Let vHolidays = Peek('Pub_Holidays');
Trace '$(vHolidays)'
Drop table Inline_Holidays, TempHoliday;
Now you can use vHolidays variable in your expression.
NetWorkDays(StartDate,EndDate, $(vHolidays))
Hi @My_Rebecca, Yes, you can use in all sections in one app.
Dear @sandeep-singh , it seems that this variable is not created successfully, the calculation is not right.
NetWorkDays([DN Creation Date],[Post Goods Issue Date],'$(vHolidays)')
hi @My_Rebecca, I checked the script and it seems to be working fine. I believe you have to make a small adjustment or formatting of dates in your script. Could you please help me with your script so that I can update it accordingly.