Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Note: You may notice some temporary visual or styling issues in the Community. Our vendor is actively investigating.
cancel
Showing results for 
Search instead for 
Did you mean: 
Mahamed_Qlik
Specialist
Specialist

Total days

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
Labels (1)
3 Replies
MayilVahanan

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

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Mahamed_Qlik
Specialist
Specialist
Author

Hi Mayi

Thanks for the response but I have given (Week name just for reference) they are not available in data model.

RafaelBarrios
Partner - Specialist
Partner - Specialist

Hi @Mahamed_Qlik 

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

https://help.qlik.com/en-US/qlikview/May2022/Subsystems/Client/Content/QV_QlikView/Scripting/DateAnd...

best,