Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
nuwanhwb87
Contributor III
Contributor III

Count Work Hours

Hi All, 

I have the below table with Fields of Date, Team, Hour 01, Hour 02,   ....... up to Hour 13 . (Hour 01 Contains the Output of First hour)

As per the below i need to calculate the Worked Hours as 8. (Biggest  Hour that works in a Day as the  worked Hours)

(In the Middle Hr 05, Hr 06 likewise can be Zero due to Breakdowns and Etc)

Please Help.

 

nuwanh_0-1619438850561.png

 

2 Replies
Saravanan_Desingh

Try this,

tab1:
LOAD * INLINE [
    Date, Team, Hr 01, Hr 02, Hr 03, Hr 04, Hr 05, Hr 06, Hr 07, Hr 08, Hr 09, Hr 10, Hr 11, Hr 12, Hr 13
    4/22/2021, Team 41, 175, 230, 200, 230, 0, 0, 0, 170, 0, 0, 0, 0, 0
    4/22/2021, Team 42, 175, 230, 200, 230, 0, 170, 0, 0, 0, 0, 0, 0, 0
    4/22/2021, Team 43, 175, 230, 200, 230, 0, 0, 0, 170, 0, 0, 0, 0, 170
];

Left Join(tab1)
LOAD Date, Team,
	Pick(Match(-1,[Hr 13] > 0,[Hr 12] > 0,[Hr 11] > 0,[Hr 10] > 0,[Hr 09] > 0
				,[Hr 08] > 0,[Hr 07] > 0,[Hr 06] > 0,[Hr 05] > 0,[Hr 06] > 0
				,[Hr 05] > 0,[Hr 04] > 0,[Hr 03] > 0,[Hr 02] > 0,[Hr 09] > 0),
				13,12,11,10,9,8,7,6,5,4,3,2,1) As [Hours Worked]
Resident tab1;
Saravanan_Desingh

Output:

commQV65.PNG

Community Browser