Context
Using Grafana 11 with a data table containing:
Current Data Structure
Field | Value
---------------|-------
runtime | 279132
Panne elec | 80
Panne moteur | 33
Panne pompe | 18
Desired Output
Transform this data only with “tranforms” into tabular format to create a bar chart with MTBF Mean Time Between Failure (runtime duration/occurence by failure) :
Cause | Occurrence | Runtime | MTBF
-------------|------------|---------|-------
Panne elec | 80 | 279132 | 3489
Panne moteur | 33 | 279132 | 8459
Panne pompe | 18 | 279132 | 15507
Technical Constraints
so you do mention that it is a single row but the data you provided is multi row
Field | Value
---------------|-------
runtime | 279132
Panne elec | 80
Panne moteur | 33
Panne pompe | 18
Does the data in the datasource look like this instead?
runtime,Panne elec,Panne moteur,Panne pompe
279132,80,33,18
This would help us emulate the original data to see what can be done.
Yes sorry, I will give you better explaination :
Actually, I don’t start with a single row in my datasource. I have two separate queries from my datasource:
- Query “states duration” - Returns the runtime duration:
runtime
279132
- Query “states occurrences” - Returns multiple tables for each failure cause as occurrences:
Panne elec
80
Panne moteur
33
Panne pompe
18
The multi-row format I showed earlier is the result of processing these two queries through several Grafana transforms:
- Join by field (to combine both queries)
- Reduce (to consolidate the data)
- Transpose (to get the current format)
So the table I’m working with:
Field | Value
---------------|-------
runtime | 279132
Panne elec | 80
Panne moteur | 33
Panne pompe | 18
Is already a transformed result, not the original datasource format. My issue is that I need to replicate that single “runtime” value (279132) as a column across all the failure cause rows, but I can’t easily do this with the current Grafana transform options.
1 Like