I have a field called Subject Error which measures which subjects students earned below passing grade.
Currently, the value spits out with one raw value:
Count of 23: English
Count of 10: Math; Science
Count of 2: English; Math; Social Studies
How can I separate semi-colon from each subject so my analysis will show below:
Count of 24: English
Count of 11: Math
Count of 10: Science
Count of 1: Social Studies
I think this is how you could do it:
Here's how this works:
Index()function to find where the colon character is in the[Subject Error]field. That result is used in theMid()function to grab just theCount of n:'part of the field. I name this new field[Start].SubField()function to get the list of subjects that come after the colon character in the[Subject Error]field. I name this new field[End].KeepChar()function to just grab the numbers from theCount of n:'string in the[Start]field so that I canSum()them in Step 6. I name this new field[Student Count].SubField()function to create a new record for each subject that gets split out on the semicolon character. Normally, you have the utilize the third parameter of theSubField()function to specify which split-out item to return but in the Data Load Editor you can omit that third parameter, which will result in a new row for each split-out item. (See Script Example 2 on the examples section of the Qlik Help page for this function.) I name this new field[Subject].Sum()aggregation function to sum up the values in the[Student Count]field. I group these summations on the[Subject]field using theGroup Byclause so that I get a total count of student for each subject. I name this new field[Total Student Count].Joined back in to the previous table so that I can use the new[Total Student Count]along with the other fields in the final step.&for string concatenation to combine the stringCount of, the[Total Student Count]field, the colon character:, and then the[Subject]field. Note that I use theDistinctkeyword in the load statement so that I am just getting one row per subject.That should result in the desired output: