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: 
suryakant241187
Partner - Contributor III
Partner - Contributor III

Need Help

Hello Team,

I am recieving data in Excel which is conatains more than 10 Lakh of records, I  am using some of the columns from that For e.g.

 

[Activity Code],  [Activity Name], Num#(LocalEmpNumber), [Attempt_Completion_Date]

I am getting duplicates record as employee can complete same activity more than one time. and i have to show the activity code with latest compltetion date.

Can anyone please help..!!

8 Replies
agomes1971
Specialist II
Specialist II

Hi,

group by the data and use max( [Attempt_Completion_Date]).

Hope it helps.

André Gomes

Anonymous
Not applicable

Hi

Use the Code like


Load
[Activity Code],
Max(Date([Attempt_Completion_Date],'DD/MM/YYYY')) as %Date
FROM
C:\Desktop\Test\Data.QVD(qvd) group by [Activity Code];


Load
[Activity Code],
[Activity Name],
Num#(LocalEmpNumber),
[Attempt_Completion_Date] as %Date
FROM
C:\Desktop\Test\Data.QVD(qvd);

anbu1984
Master III
Master III

Load [Activity Code],  Firstsortedvalue([Activity Name],-[Attempt_Completion_Date]), Firstsortedvalue(LocalEmpNumber,-[Attempt_Completion_Date]), FirstSortedValue([Attempt_Completion_Date],-[Attempt_Completion_Date]) Group by [Activity Code];

Load

[Activity Code],  [Activity Name], Num#(LocalEmpNumber) As LocalEmpNumber, Date#([Attempt_Completion_Date],'M/D/YYYY') As [Attempt_Completion_Date] From Table;

suryakant241187
Partner - Contributor III
Partner - Contributor III
Author

Hello,

Not able to find correct reocords. Please see below scenario:

Activity CodeActivity NameLocalEmpNumberAttempt Completion Date
ILC-CFCards Dev12346/9/2013 0:00
ILC-CFCards Dev12346/9/2014 0:00
ILC-CFCards Dev12349/27/2011 0:00
ILC-EMGPlanning 12349/27/2012 0:00
ILC-EPE-Payments12345/30/2012 0:00
ILC-FSBusiness Analysis12347/2/2013 0:00
ILC-FSBusiness Analysis123411/5/2013 0:00
ILC-FSBusiness Analysis123411/6/2013 0:00
ILC-EPE-Payments123412/13/2012 0:00
ILC-HSKManaging performers12346/16/2011 0:00

As in above :

1234 employee has completed ILC-CF course 3 times but his latest  completion date is 6/9/2014 so i requires only this record.

File contains more than lakh records.

can anyone please help.

Anonymous
Not applicable

Hi,

How about below script,

LOAD

     [Activity Code], 

     [Activity Name],

     Num#(LocalEmpNumber) as LocalEmpNumber,

     Date(Max([Attempt_Completion_Date])) as [Attempt_Completion_Date]

<TableName>

GROUP BY [Activity Code], [Activity Name], Num#(LocalEmpNumber);


Thanks

Not applicable

Hi Suryakant,

Use max of completion date ,and then use group by other dimensions.

It will take max date for a similar group of records when you use group by with other fields.

thanks

Sudhanshu shrivas

anbu1984
Master III
Master III

Check this app

sujeetsingh
Master III
Master III

Check this code

Here i have used logic to get the EmpID with only Stat with highest EventRank.

This for script level well at ui level you can easily implement this with dimension as EmpID and taking max() of Event rank.

Tab:

LOAD * INLINE [

    EmpID, EventRank, Stat

    1, 2, A

    1, 5, D

    1, 4, F

    1, 6, F

    2, 1, S

    2, 6, S

    2, 8, R

    4, 3, D

    4, 3, D

   

];

left Join(Tab)

LOAD

EmpID

,max(EventRank) as Latest

Resident Tab group by EmpID;

Data:

LOAD

EmpID

,if(Latest=EventRank,Stat,null()) as Stat

Resident Tab where if(Latest=EventRank,Stat,null())<>null();

DROP Table Tab;