Dashboards based on a subquery


I would like to aggregate data into a pie chart based on the newest data for a specific type id.
In other words something like

category | type_id | @timestamp

category1 | abcd | 2022-08-26
category1 | abcd | 2022-08-25
category1 | efgh | 2022-08-26
category2 | xyz | 2022-08-26

This should result in a py chart with 2 segments. One that counted 2 (category1 with type_id abcd efgh) and a slice of 1 (category 2 with type_id xyz).

Thank you.

Not sure if completely got your request so please let me know if that's not what you're looking for. How about using a Lens pie chart with two slice by defined? (one for category, the other for id?)

Thank you for your fast reply, but this is not exactly what i was looking for.

What i meant was counting all categories, but only count the newest type_id if there are multiple.

Which would lead to 2 category counts
category1 comes 3 times, but i only want to count abcd once => count of 2
category2 only has xyz which is already unique

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.