Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi
I have below employee sample data for there regular attendance:
I want to calculate number of days there are present excluding weekends ( weekend start is friday and end on saturday)
| Date | Time In | Time Out | No. of days | |
| Total 5 | ||||
| 9/1/2022 | Saturday | 0 | 0 | 0 |
| 9/2/2022 | Sunday | 800 | 1500 | 1 |
| 9/3/2022 | Monday | 900 | 1700 | 1 |
| 9/4/2022 | Tuesday | 815 | 1515 | 1 |
| 9/5/2022 | Wednesday | 700 | 1400 | 1 |
| 9/6/2022 | Thursday | 830 | 1430 | 1 |
| 9/7/2022 | Friday | 0 | 0 | 0 |
| 9/8/2022 | Saturday | 0 | 0 | 0 |
Hi
LOAD *, if(Match(WeekDay(Date),'Sat','Fri') ,1,0) as Flag INLINE [
Date, WeekDay, Time In, Time Out
1/1/2022, Saturday, 0, 0
1/2/2022, Sunday, 800, 1500
1/3/2022, Monday, 900, 1700
1/4/2022, Tuesday, 815, 1515
1/5/2022, Wednesday, 700, 1400
1/6/2022, Thursday, 830, 1430
1/7/2022, Friday, 0, 0
1/8/2022, Saturday, 0, 0
];
Use flag to include or exclude weekend in your front end calculation
Hi Mayi
Thanks for the response but I have given (Week name just for reference) they are not available in data model.
Weekday field It’s not needed
@MayilVahanan is creating a flag from the date field
if(Match(WeekDay(Date),'Sat','Fri') ,1,0) as Flag
only Comment that the weekday function will return numbers and not text (I could be wrong). So according to you regional config the numbers could change
best,