Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello, I am quite new to Qliksense, I have a dataset and I would like to slice this dataset similar into quartiles/quintiles in order to rank my Costumers by varA. I want to know in which quartile/quintile my costumer belongs to according to my varA.
I have the following code in the chart :
if(varA<= fractile(Total varA,0.20), 1,
if( varA <= fractile(Total varA, 0.40), 2,
if( varA <= fractile(Total varA, 0.60), 3,
if( varA <= fractile(Total varA, 0.80), 4, 5)))))
That works. I have something similar to this:
Costumer 1 VarA Quintile
1 a Q1
2 b Q2
3 c Q4
...
However I would like to do it the the script. Is it possible?
Should work just like that. Only have to add group by.
Hello Almen,
Thank you for your reply.
It doesn't, I have the following error message: 'Aggregation expressions required by GROUP BY clause.'.
I've tried to replace 'Total' by sum() but have another error message saying that nested aggregation is not possible...
That's why I wrote you have to add group by.
It would look like this:
Table:
LOAD
Costumer,
varA,
if(varA<= fractile(Total varA,0.20), 1,
if( varA <= fractile(Total varA, 0.40), 2,
if( varA <= fractile(Total varA, 0.60), 3,
if( varA <= fractile(Total varA, 0.80), 4, 5))))) as Quantile
From Source group by varA, Costumer;