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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
AMorella
Contributor II
Contributor II

Count Multiple Items in a Field

I'm working on an app to calculate the total cost per unit. The only challenge is there may be multiple units indicated in a single field and I need to divide by the total count of units of all rows.

For example: 

BEAU5526356, GCXU5523584, TCNU4967930 are in 1 row of data, so I'd need to show a count of 3 for this row.

Is anyone aware of a means to count these rows and then calculate a total? The total part should be straightforward; but I've no idea how to calculate a count within a field.

 

Thanks in advance! 

Labels (2)
1 Solution

Accepted Solutions
vincent_ardiet_
Specialist
Specialist

You can use SubStringCount and count the commas + 1. 

View solution in original post

3 Replies
vincent_ardiet_
Specialist
Specialist

You can use SubStringCount and count the commas + 1. 

AMorella
Contributor II
Contributor II
Author

Vincent,

Thank you. This works perfectly!

vincent_ardiet_
Specialist
Specialist

Note that you can also use SubField in your loading script to split those strings into rows (in a separate table for example). But it depends of what you want to do next and of the amount of data you have. However SubStringCount could be enough for your need.