Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
david_zammit
Contributor
Contributor

Multiple record handling for counts

Hello!

i have hopefully an easy expression related question.

i have a table where i have multiple records with one related value then another value which changes, i want to count said value based on the second value.

example data i have VALUE with 3 records, i want to only count it once based on the second value criteria. IF A is found then count, if no A is found but N is found count else if no A or N only null then count.

VALUE, 'A'

VALUE, 'N'

VALUE, 'null'

 

what currently happens whenever i try to get a good result, i can either get it to count a specific result or all results, i cant seem to figure out how to logically count based on the results.

###update i tried an expression like below, but found it was relative only to a single record so i couldnt actually isolate the values i wanted

 

=Sum(
If(Match([ABCindicator],'A','B','C'), 1,
If(Match([ABCindicator],'N') and Not Match([ABCindicator],'A','B','C'), 1,
If(Match([ABCindicator],'') and Not Match([ABCindicator],'A','B','C','N'), 1, 1
))))

1 Reply
marcus_sommer

You need to aggregate your indicator before you could apply your conditions. It may then look like:

sum(if(match(aggr(concat(ABCindicator, ','), Dimensions), 'YourCondition1', 1,
          if(match(aggr(concat(ABCindicator, ','), Dimensions), 'YourCondition1', 1, ...)))

Depending on the amount of data and further requirements it might be better to transfer this kind of task into the script.

- Marcus