Merge rows which have same value in different columns

  • What Grafana version and what operating system are you using? version: 11.1.0 and Windows

  • What are you trying to achieve?
    I’m trying to merge rows based on the column values.

namespace/resource image_repo/imagetag Severity Column 4
alpha/redis1 bitnami/1 Critical 10
alpha/redis1 bitnami/1 High 5
alpha/redis2 bitnami/1 Critical 10
alpha/redis2 bitnami/1 High 5
alpha/redis3 bitnami/1 Critical 10
alpha/redis3 bitnami/1 High 5


or

If you see the images, namespace (alpha) has 3 different resources (redis1, redis2, redis3) with same image_repo(bitnami) and same image_tag(1) with two different severities (critical and high).
So, I need to merge row 1,3,5 and row 2,4,6, because they have same namespace, same image_repo/image_tag and same severities, which should look like this after merging/combining:
grafana_community_1
or

Data source: Prometheus
PromQL I’m using:
sum by (namespace, resource_name,combined_label_1,severity)(
label_join(
label_join(
trivy_image_vulnerabilities,
“combined_label”,
“/”,
“namespace”,
“resource_name”
),
“combined_label_1”,
“/”,
“image_repository”,
“image_tag”
)
)