Transformation - How to map "Rows to Fields"

  • Grafana version 9.1.2 on RHEL

  • What are you trying to achieve?
    I need to map results from different (Prometheus)queries into a table with ‘sets of columns’

In a table panel I have 3 queries (Active, Errors, Warnings) leading to following result sets

Query		Key    SQ    Value
Active		X      1     1 
			X      2     1 
			X      3     0 
			A      1     1 
			A      2     1 
			A      3     0 

Errors		X      1     1  
			X      2     0  
			X      3     0  
			A      1     1  
			A      2     0  
			A      3     0  

Warnings	X      1     2 
			X      2     2 
			X      3     0 
			A      1     2 
			A      2     2 
			A      3     0 

With following transformations, I can put the results for the metrics on one line.

  • Filter by Name : to exclude some columns
  • Merge
  • Organize Fields : to rename fields
Key  SQ   Active Errors Warnings
X    1    1      1      2
X    2    1      0      2
X    3    0      0      0
A    1    1      1      2
A    2    1      0      2
A    3    0      0      0

Next I want to bring together the values per sequence, but I don’t know how to use the Rows to Fields mapping to achieve the following

Key  SQ-1   Act-1  Err-1  Warn-1   SQ-2   Act-2  Err-2  Warn-2    SQ-3   Act-3  Err-3  Warn-3
X    1      1      1      2        2      1      0      2         3      0      0      0
A    1      1      1      2        2      1      0      2         3      0      0      0

A finally remove the SQ columns

Key  Act-1  Err-1  Warn-1   Act-2  Err-2  Warn-2    Act-3  Err-3  Warn-3
X    1      1      2        1      0      2         0      0      0
A    1      1      2        1      0      2         0      0      0

Can I use Rows To Fields transformation or is there another way to achieve this?