Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
This is my example data:
ID 1 | Param1 | Param2 |
---|---|---|
1 | 3 | 2 |
1 | 5 | 6 |
2 | 3 | 7 |
2 | 4 | 10 |
I want this (in form of a pivot table perhaps):
| param1 | param2 |
----------------------------------------------------
id | avg | min | max | | avg | min | max |
----------------------------------------------------
1 | 4 | 3 | 5 | | 4 | 2 | 6 |
2 | 3.5 | 3 | 4 | | 8.5 | 7 | 10 |
Now I know I could do this (without the headers in pivot table 2 (param1, param2) by just creating measures with the aggr (min, max etc) but it will becomes very tedious when I have 10 parameters and 7 aggregations (min, max, median, avg, std, skew, count). Is there any simple way to make this automated? For instance, I just choose the parameter and it automatically creates 7 measures for the given parameter. Note, this concerns Qlik Sense.
Create a Parameter field in the script and use that as dimension:
CrossTable(Parameter,Value)
LOAD
ID1,
Param1,
Param2
FROM
...mysource...
;
Hi,
You can try CrossTable() to unpivot the data. Check below link for sample script
Regards,
Jagan.
But you still need to create 7 measures for each of the parameters, meaning if you have 10 parameters, you need to create 70 measures (min, max, median, avg, skew, std, count)?
No, I don't think that is necessary. Parameter is a dimension (if you cross table load as suggested), and you then need one expression for each aggregate (3 in your original post - avg(), min() and max()).