I've got the following data sheet:
date(A) source(B) cost(C) totals(D) val(E)
9-8-2019 Magic 0.00 0 0.00
9-8-2019 Stick 54.72 6820 8.02
9-8-2019 Foo -41.36 17841 0.00
9-8-2019 Bar 29.66 79652 0.47
9-8-2019 Magic 29.79 79937 0.47
9-8-2019 Stick 0.00 0 0.00
9-8-2019 Foo -41.52 17906 0.00
9-8-2019 Bar 54.72 6820 8.02
7-8-2019 Magic 29.79 79937 0.47
7-8-2019 Stick 0.00 0 0.00
7-8-2019 Foo -41.52 17906 0.00
7-8-2019 Bar 54.72 6820 8.02
7-8-2019 Magic 21.10 79937 0.47
7-8-2019 Stick 0.00 0 0.00
7-8-2019 Foo -40.52 17906 0.00
7-8-2019 Bar 55.72 6820 8.02
To get all the results of today its as easy as =query(Data!A:E; "SELECT A, B, C, D WHERE A = date'"&TEXT(TODAY(); "yyyy-mm-dd")&"'";0)
I would like to group it by source and select the latest values (cost, totals, val). But when applying the first part of the query (GROUP BY B
) the error said: CANNOT_GROUP_WITHOUT_AGG
.
What is the best way to achieve this?