Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all.
Could you please help me to solve next task.
I'm loading field and I need to group values this field have.
What I'm loading looks like this:
FieldName
Item1
Item2
Item3
Item4
Item5
Item6
Item7
Item8
Item9
Item10
I need to combine items in the field into a group of 4 pieces. If there are less than 4 items, then combine as many as there are. So result expected to be like this
FieldName, FieldGroup
Item1, Group1
Item2, Group1
Item3, Group1
Item4, Group1
Item5, Group2
Item6, Group2
Item7, Group2
Item8, Group2
Item9, Group3
Item10, Group3
I can't just bring groups manually because there will new item with each data refresh, so grouping process should be automatized somehow. I will be thankful for any hint hot this could be done.
You could do something like this:
Data:
Load * Inline [
FieldName
Item1
Item2
Item3
Item4
Item5
Item6
Item7
Item8
Item9
Item10
];
Groups:
LOAD
FieldName,
'Group' & (Mod(FieldIndex('FieldName', FieldName),4)+1) as Group
Resident Data;
Change the "4" if you want a different number of groups.
-Rob
http://www.easyqlik.com
http://masterssummit.com
http://qlikviewcookbook.com
You could do something like this:
Data:
Load * Inline [
FieldName
Item1
Item2
Item3
Item4
Item5
Item6
Item7
Item8
Item9
Item10
];
Groups:
LOAD
FieldName,
'Group' & (Mod(FieldIndex('FieldName', FieldName),4)+1) as Group
Resident Data;
Change the "4" if you want a different number of groups.
-Rob
http://www.easyqlik.com
http://masterssummit.com
http://qlikviewcookbook.com
@rwunderlich Thank you! This is exactly what I need!