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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Set Analysis Required

Hello All,

I have already created a discussion for same but have not got proper syntax solution:

I have 3 fields(say):

INTime, ShiftStartTime, AttendanceStatus.

I have to use set analysis with the condition:

if(INTime>ShiftStartTime and  AttendanceStatus='P','POW','MIS' then count(distinct(date))

IS it required any conversion for Time say NUM() to compare??

Please suggest.

Please find the sample attachment....

I have to generate a report of Emp with how many times he was late

Regards,

Balraj

9 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

If INTime and ShiftStartTime are both timestamp or date and time fields, then no conversion is required:

Count({<AttendanceStatus={'P','POW','MIS'}>} DISTINCT If(INTime > ShiftStartTime, date))

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
manideep78
Partner - Specialist
Partner - Specialist

Hi,

Try like this.

Count({<INTime={">shiftStartTime"},AttendanceStatus={'P','POW','MIS'}>}DISTINCT date)

Make you sure you have appropriate date formats in all the date fields.

hope this helps.

Regards,

Manideep

Anonymous
Not applicable
Author

Your syntax is working similar to :

Count({<_AttendanceStatus={'P','POW','MIS'}>} distinct(Date))

which is not helping in validation..,..

Anonymous
Not applicable
Author

Manideep,

Its returning 0.

I have checked twice format is same....

ashfaq_haseeb
Champion III
Champion III

Hi,

Can you post sample application?

Regards

ASHFAQ

manideep78
Partner - Specialist
Partner - Specialist

Can you please post your app with sample data.

sagarkharpude
Creator III
Creator III

Try

Count({<INTime={">$(shiftStartTime)"},AttendacneStatus={'P','POW','MIS'}>}DISTINCT date)

jonathandienst
Partner - Champion III
Partner - Champion III

Then INTime and ShiftStartTime are not directly comparable timestamp fields. I suggest that you post a sample as others have suggested if you want help in diagnosing the problem.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

This is how I've done it and it works correctly with the sample data you posted:

I added a calculated field to the script:

if(INTIme > ShiftTime, 1, 0) as Test

this returns 1 if INTime is greater than ShiftTime and 0 when it's not


The expression you then want to use is:

Count({<Test={'1'}, AttendanceStatus={'P','POW','MIS'}>} ID)


I attach a test dashboard!


Thank you