How to display only the latest records in quicksight?

Hi QS Community,

I am trying to achieve below to display
latest(value) and latest(datetime) by location

Whereas I am getting below using QS by doing this:

Screen Shot 2023-04-12 at 5.08.42 pm

Also I have tried lastvalue function as below but no avail

lastValue(value,[datetime DESC], [location])

Can you please advise?


Hi @faisalchohan

Please create a calculated field to find the latest-time by location and filter to show only recent records.

ifelse(maxOver(datetime, [locationcode], PRE_AGG) = datetime, 1, 0)

Once you create the calculate field , create a visual level filter to show only the records with ‘1’.

After applying filter

Before applying filter



Thanks Vinod for you help. Much Appreciated. It seems to be working as expected. Once thing i need to check from my end as I am unable to get the latest datetime for example I am expecting as per current time Wed, 12, 2023T09:12:15 but instead I am getting this data Wed, 12, 2023T02:12:15 which is 7hours old, this may be issue from my source.
Thanks again