Put a last position of a car on a map in accordance with a temporal filter
I uploaded a table on Qlik Sense, called CarTable. Its columns are: Car Plate, Fuel Used, Day, Longitude, Latitude, Country. In short, for each car is reported the fuel consumption in each day that it has been used. It’s also reported the car location (Latitude, Longitude, Country) in which the measurement took place. The aim is to get on a map the last location of each car, according to a temporal filter (created with SenseDateRangePicker extension).
Example (invented data):
1020F 20 2017/08/21 8.919824945.3930345 Italy
1020F 12 2017/08/23 8.935588445.4196049 Italy
1020F 3 2017/08/30 9.117011245.5273901 Italy
… … … … … …
1020F 25 2017/09/29 9.164446645.3491890 Italy
1020F 10 2017/10/02 8.980769445.3948133 Italy
1234C 40 2017/09/21 9.060422245.3163479 Italy
1234C 20 2017/09/22 9.285222945.5134926 Italy
1234C 15 2017/09/30 8.985304445.3878548 Italy
… … … … … …
1234C 20 2017/10/03 9.106899945.3601810 Italy
… … … … … …
After uploading the table, in Editor Upload Data (Section automatically generated) appears the following code and I think that it is right:
APPLYMAP( '__countryCodeIsoThree2Polygon', APPLYMAP( '__countryName2IsoThree', LOWER([Country])), '-') AS [CarTable.Country_GeoInfo],
GeoMakePoint([Latitude], [Longitude]) AS [Longitude_Latitude]
(txt, utf8, embedded labels, delimiter is ';', msq);
Longitude_Latitude is a new dimension created to position cars on a map.
In order to get on a map the last location of each car in accordance with the temporal filter, I have implemented the following two solutions (none of these work):
1) In Editor Upload Data (Section automatically generated) I have added the following code:
date(max("Day")) as LastDay
GROUP BY CarPlate
Inner Join (CarTable)
[CarPlate] as Last_CarPlate,
[FuelUsed] as Last_FuelUsed,
[LastDay] as Last_Day,
[Country] as Last_Country,
[Latitude] as Last_Latitude,
[Longitude] as Last_Longitude,
APPLYMAP( '__countryCodeIsoThree2Polygon', APPLYMAP( '__countryName2IsoThree', LOWER([Country])), '-') AS [LastPositionInfo.Country_GeoInfo],
GeoMakePoint([Latitude], [Longitude]) AS [Last_Location]
WHERE "Day" = LastDay
The LastPositionInfo table is correctly created but it is not updated with the temporal filter.
For example: without a temporalfilter the last measurement for a car with 1020F plate is 2017/10/02. The record corresponded to this day is reported in LastPositionInfo table. But if I put the temporal filter “from 2017/09/01 to 2017/09/30” its last measurement should become 2017/09/29 while in the table is still reported 2017/10/02 and its corresponding location.
2) I have created a new dimension (called LastLocation) with the following expression:
However, this new dimension is empty and I don't know if it is possible to put it on a map.
Can someone help me? First, is it possible to do this in Qlik Sense? In case, which is the best way to do this?