Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
garyk22
Contributor II
Contributor II

Split data based on Account Ids separated by ";"

Hi All,

 

Please see the below data which I am trying to split based on User-Ids. Not sure how to achieve this as I just started using Qlik Sense.

 

This is the table that I am able to pull directly from Database where I need to split customers based on User Id and call data

account IdCustomer NameUser Ids AssignedCalled By UserIdNumber of CallsComments
873864736RTW39948IJake Bailey;1911-101103;1911-101106;1911-10110311 call by 2 users so needs a split with 0 and 1
983729846wqienndxasKen Sorjati;1911-101210;--Needs no slipt -  1 User 0 calls
0011a00000b28jHAAQCheryl Blackwell;1911-101108;1911-1011081Needs no slipt -  1 User 1 call
193742091874nnjdchqErin West;1911-101210;1911-101211;--Needs to be split by muliple users
whfkwhkfdj1y262521Randy Wayne;1911-101109;1911-101102;1911-101110;1911-101111;1911-1011091there are 2 calls by 2 users but total users are 4 this needs to be split in 4 users
1911-1011101

 

 

This is the desired output

account IdCustomer NameUser Ids AssignedCalled By UserIdNumber of Calls
873864736RTW39948IJake Bailey1911-1011031911-1011031
873864736RTW39948IJake Bailey1911-101106 0
983729846wqienndxasKen Sorjati1911-101210-0
0011a00000b28jHAAQCheryl Blackwell1911-1011081911-1011081
193742091874nnjdchqErin West1911-101210-0
193742091874nnjdchqErin West1911-101211-0
whfkwhkfdj1y262521Randy Wayne1911-1011091911-1011091
whfkwhkfdj1y262521Randy Wayne1911-1011101911-1011101
whfkwhkfdj1y262521Randy Wayne1911-101111-0
whfkwhkfdj1y262521Randy Wayne1911-101102-0

 

Not sure if this can be achieved, if yes, then how?

 

Thank you.

Labels (3)
1 Solution

Accepted Solutions
GaryGiles
Specialist
Specialist

Try adding this to your load script:

subfield([User Ids Assigned],';') as [User Ids Assigned]

If you end up with a row with a blank User Ids Assigned, you may need to avoid the first ';', 

subfield(mid([User Ids Assigned],2),';') as [User Ids Assigned]

 

View solution in original post

3 Replies
GaryGiles
Specialist
Specialist

Try adding this to your load script:

subfield([User Ids Assigned],';') as [User Ids Assigned]

If you end up with a row with a blank User Ids Assigned, you may need to avoid the first ';', 

subfield(mid([User Ids Assigned],2),';') as [User Ids Assigned]

 

garyk22
Contributor II
Contributor II
Author

@GaryGiles 

Thank you for your response. I tried this but it shows me only 1 row but I need 4 rows with same name and id but different user ids.

If you see attached picture, Randy Wayne and his account id should show 4 times and if someone has only 2 then 2 times

 

GaryGiles
Specialist
Specialist

It should work.  Below is the load script that I just ran and it gave the desired number of rows.

Load
[account Id],
[Customer Name],
subfield(mid([User Ids Assigned],2,len([User Ids Assigned])-2),';') as [User Ids Assigned],
[Called By UserId],
[Number of Calls],
[Comments]
inline [
account Id,Customer Name,User Ids Assigned,Called By UserId,Number of Calls, Comments
873864736RTW39948I, Jake Bailey, ;1911-101103;1911-101106;, 1911-101103, 1, 1, call by 2 users so needs a split with 0 and 1
983729846wqienndxas, Ken Sorjati, ;1911-101210;, -, -, Needs no slipt - 1, User 0 calls
0011a00000b28jHAAQ, Cheryl Blackwell, ;1911-101108;, 1911-101108, 1, Needs no slipt - 1 User 1 call
193742091874nnjdchq, Erin West, ;1911-101210;1911-101211;, -, -, Needs to be split by muliple users
whfkwhkfdj1y262521, Randy Wayne, ;1911-101109;1911-101102;1911-101110;1911-101111;, 1911-101109, 1, there are 2 calls by 2 users but total users are 4 this needs to be split in 4 users
];