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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Jarvay
Contributor II
Contributor II

Identifying missing entries

Hi,

I have a set of data below showing entries by staff from 2 Oct to 15 Oct and I need to use Qlik to show 2 things:

1. How many staff did not provide entries for 2 days or more (Ans: 2).

2. Show who are the staff who did not provide entries for 2 days or more (Ans: Staff 10 and Staff 1002).

Can anybody please advise? Thank you in advance.

Staff NameTemperatureRecorded On
Staff 136.802/10/2020
Staff 136.903/10/2020
Staff 136.904/10/2020
Staff 136.805/10/2020
Staff 136.806/10/2020
Staff 136.807/10/2020
Staff 136.808/10/2020
Staff 136.709/10/2020
Staff 136.810/10/2020
Staff 136.911/10/2020
Staff 136.912/10/2020
Staff 136.813/10/2020
Staff 136.814/10/2020
Staff 136.815/10/2020
Staff 103602/10/2020
Staff 103606/10/2020
Staff 103607/10/2020
Staff 103608/10/2020
Staff 103609/10/2020
Staff 103610/10/2020
Staff 103612/10/2020
Staff 103613/10/2020
Staff 103614/10/2020
Staff 100236.502/10/2020
Staff 100236.503/10/2020
Staff 100236.504/10/2020
Staff 100236.506/10/2020
Staff 100236.507/10/2020
Staff 100236.509/10/2020
Staff 100236.510/10/2020

 

4 Replies
rubenmarin

Hi @Jarvay , for the fist one you can use:

=Sum(Aggr(If(Count(DISTINCT [Recorded On])<Count(DISTINCT TOTAL [Recorded On]),1), [Staff Name]))

and for the 2nd:

=Concat(Aggr(If(Count(DISTINCT [Recorded On])<Count(DISTINCT TOTAL [Recorded On]),[Staff Name]), [Staff Name]), ',')

Jarvay
Contributor II
Contributor II
Author

Hi Rubenmarin,

Thanks for the advice! Sorry but I forgot to to add that the staff has to have missed providing inputs for consecutively 2 days before it is considered as a count. My bad... 

rubenmarin

Hi @Jarvay then it will be better to flag those records on script... and if the staff misses for 4 consecutive days it counts as 1, or 2 or 3?

// Cartesian of staff and dates
tmpStaffDates:
LOAD 
	 FieldValue('Staff Name', RecNo()) 	as [Staff Name]
AutoGenerate FieldValueCount('Staff Name');

Outer Join (tmpStaffDates)
LOAD 
	 FieldValue('Recorded On', RecNo()) 	as [Recorded On]
AutoGenerate FieldValueCount('Recorded On');

// Add values (the ones witout values will be null)
Left Join (tmpStaffDates)
LOAD [Staff Name], [Recorded On], Temperature
Resident TableDataName;

// Remove previous data table to keep the temporary as the data table
DROP Table TableDataName;

// Flag records
TableDataName:
LOAD [Staff Name], [Recorded On], Temperature,
  If(Peek([Staff Name])=[Staff Name] and IsNull(Temperature) and IsNull(Peek(Temperature))
    ,If(Peek(isGap)=0 and not IsNull(Peek(Temperature,-2)), 1, 0) //This is to flag only the first 2 days gap
    ,0) as isGap
Resident tmpStaffDates
Order By [Staff Name], [Recorded On];

// Remove temporary table
DROP Table tmpStaffDates;

Expression can be:

- Sum(isGap)

- Concat(DISTINCT {<isGap={1}>} [Staff Name], ', ')

Jarvay
Contributor II
Contributor II
Author

Hi Rubenmarin,

A big thanks! Looks complicated for a beginner like me but will take some time to study the solution.

And if the staff misses providing inputs for 4 consecutive days, it should count as 1.