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: 
qliktech_uk
Contributor III
Contributor III

Retrieving the latest record for dimension values.

Hi,

I have data for mobile numbers along with the latest call date/time. I want to capture the mobile number with the latest time.

Eg:

Mob   Call date/time 

ccc     25/09/2017 10:00:00

ccc     24/09/2017 10:00:00

xxx     25/09/2017 10:00:00

bbbb   25/09/2017 10:00:00


My report should be

Mob   Call date/time 

ccc     25/09/2017 10:00:00

xxx     25/09/2017 10:00:00

bbbb   25/09/2017 10:00:00


I need to exclude ccc and pick up only the laatest record for ccc.

1 Solution

Accepted Solutions
krishnacbe
Partner - Specialist III
Partner - Specialist III

Try below script.

Temp_Data:
LOAD Mob,
[Call date/time ]
FROM TestData.txt
(
txt, codepage is 1252, embedded labels, delimiter is '\t', msq);

Data:
Load Mob,
MaxString([Call date/time ]) as [Call date/time]
Resident Temp_Data
Group by Mob;

drop Table Temp_Data;

View solution in original post

6 Replies
vvira1316
Specialist II
Specialist II

You may be able to use Max/MaxString on Call date/time field

krishnacbe
Partner - Specialist III
Partner - Specialist III

Use below formula as calculated Dimension for Call Date/Time.

ggr(MaxString([Call date/time ]), mob)


Hope it helps.

krishnacbe
Partner - Specialist III
Partner - Specialist III

Correct Formula

Aggr(MaxString([Call date/time ]), mob)

qliktech_uk
Contributor III
Contributor III
Author

Thanks for your reply. Cant we do this at the script level, as I dont want to bring back data that isnt useful.

krishnacbe
Partner - Specialist III
Partner - Specialist III

Try below script.

Temp_Data:
LOAD Mob,
[Call date/time ]
FROM TestData.txt
(
txt, codepage is 1252, embedded labels, delimiter is '\t', msq);

Data:
Load Mob,
MaxString([Call date/time ]) as [Call date/time]
Resident Temp_Data
Group by Mob;

drop Table Temp_Data;

qliktech_uk
Contributor III
Contributor III
Author

Thanks Krishnapriya.