Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I am trying to group my data in QlikView. And it is not going well.
I am using the following script:
if(place='K1' or place='K2' or place='K4', 'K1,K2,K4', | |
if(place='K1', 'K1', | |
if(place='K2', 'K2', | |
if(place='K3', 'K3', | |
if(place='K4', 'K4', | |
))))) as test |
but all I get out, is the first field, that combines the three fields.. But it does not give me the separate values at all.
I have attached a workbook also to this message.
Any ideas how to approach this ?
I am trying to show these values in a pivot-table.
Cheers,
Niko
You are right! I just copied and pasted it. Additional else parts are redundant there. Now stroke off.
But there is only one problem, this does not show inside a pivot-table for some reason o.O
Cheers,
Niko
It should, if you use aggregation function like Sum(Value1) as expression.
Hi,
Could you please open a little bit, what are you doing on that concatenate part of this script :)?
It would be very nice!
Cheers,
Niko
You can use below one as well
Concatenate
Load part, Replace(place,'|',', ') as place, value1, value2 Where place = 'K1|K2|K4';
Load Distinct
part,
Concat(place,'|',place) as place,
Sum(value1) as value1,
Sum(value2) as value2
Resident DATA
Where Match(place,'K1','K2','K4')
Group by part
Order By part,place
;
Concat(place,'|',place) as place,
This will Concat Distinct place and separate them by |
the last parameter place will make sure that the concatenation will happens in order.. i.e. even if K4, K2 and K1 is the right order, they will concatenate as K1, K2 and K4
Now consider that you have only K1 and K2 available for any part but you want only parts with K1, K2 and K4 then you can use below one.. otherwise you can ignore below line.
Load part, Replace(place,'|',', ') as place, value1, value2 Where place = 'K1|K2|K4';