-
What Grafana version are you using?
11.0.0 -
What are you trying to achieve?
Having data:
abc,999e3654-133d-452d-88d6-b38d6aba053d
abc,b831d2b9-1cac-40fd-8faa-2abd0112b57e
abc,999e3654-133d-452d-88d6-b38d6aba053d
abc,a23a84de-2f2f-45f5-b424-083195798f73
abc,999e3654-133d-452d-88d6-b38d6aba053d
abc,a23a84de-2f2f-45f5-b424-083195798f73
xyz,999e3654-133d-452d-88d6-b38d6aba053d
xyz,a23a84de-2f2f-45f5-b424-083195798f73
xyz,a23a84de-2f2f-45f5-b424-083195798f73
xyz,a23a84de-2f2f-45f5-b424-083195798f73
xyz,b831d2b9-1cac-40fd-8faa-2abd0112b57e
xyz,b831d2b9-1cac-40fd-8faa-2abd0112b57e
I need to group data and count the number of occurrences for each combination of name and type.
For SQL I normally do something like this:
SELECT
name,
type,
COUNT(*) AS amount
FROM
data
GROUP BY
name,
type
ORDER BY
name,
type;
- How are you trying to achieve it?
- Add Transformation “Group by”. For field name and type I set “Group by”.
- Add Transformation “Add field from calculation”. Mode - Reduce row, Operation - name, type. Calculation - Count.
- What did you expect to happen?
Expected to have a table with results:
abc,999e3654-133d-452d-88d6-b38d6aba053d,3
abc,a23a84de-2f2f-45f5-b424-083195798f73,2
abc,b831d2b9-1cac-40fd-8faa-2abd0112b57e,1
xyz,999e3654-133d-452d-88d6-b38d6aba053d,1
xyz,a23a84de-2f2f-45f5-b424-083195798f73,3
xyz,b831d2b9-1cac-40fd-8faa-2abd0112b57e,2
- What happened wrong?
Having table with results:
abc,999e3654-133d-452d-88d6-b38d6aba053d,2
abc,a23a84de-2f2f-45f5-b424-083195798f73,2
abc,b831d2b9-1cac-40fd-8faa-2abd0112b57e,2
xyz,999e3654-133d-452d-88d6-b38d6aba053d,2
xyz,a23a84de-2f2f-45f5-b424-083195798f73,2
xyz,b831d2b9-1cac-40fd-8faa-2abd0112b57e,2