We have a dataset consisting of points (x,y). At each of these points, analytical data has been collected at different dates. The dates are not the same for all points. An example of the dataset is shown below:

Point; x; y; date; analytical data
B1; x1; y1; 1-1-17; 10
B1; x1; y1; 1-2-17; 100
B1; x1; y1; 1-3-17; 5
B2; x2; y2; 1-1-17; 1
B2; x2; y2; 1-3-17; 10
B2; x2; y2; 1-4-17; 100
B3; x3; y3; 1-2-17; 1000

The question is now: In QGIS, how can we plot the 'analytical data' from the latest sampling date? So, one value for each point.

We assume this can be done by using 'an expression', we just cannot figure out how?


Could Virtual Layer be an option?

SELECT * FROM ( SELECT *, max(date) FROM your_layer GROUP BY Point)

if Point field is not unique, then:

SELECT * FROM ( SELECT *, max(date) FROM your_layer GROUP BY geometry)

By the way, you might have to change the style of your date field to 2017-01-01.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.