Context
I have a data cube, containing rows with (simplified for the example): id, sent, open. ID is an identifier, sent is an int (how many sent messages), open as well (how many messages open).
I want to eventually have a table in a dashboard with for each column (sent, open in my case) the absolute value and a computed value (percentage in my case, which will eventually depend on a few other columns in a less simplistic setting).
So if the input is 42, 50, 20
, I want to see:
> sent 50 100%
> open 20 40%
This is not directly possible (I cannot add a 2nd column to my table if it’s not in the data). That’s why I am trying to build a relevant datacube.
Question
How can I build the relevant cube?
What I tried
Transpose, pivot, unpivot. None of them will do what I want.
I ended up thinking that I should duplicate each row, adding one column: for the first row the column (eg. calculation_type) would be ‘absolute’, for the 2nd it would be ‘percentage’. If I end up here, I should be able to display my data as wished, after a pivot on calculation_type.
But as far as I can tell, there are no transforms duplicating rows, and you cannot use twice the same source cube, so I feel stuck.
Test data
I am using a python step to simulate my real original cube:
return [[42], [50.0], [20.0]]
and I expect to see the table I showed above.
Thanks,