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: 
Not applicable

Sum of conditional count of records

Greetings;

I have a one-to-many parent-child table relationship.  Incident tickets are in the parent table, incident comments are in the child table.

I want to count the incidents by quarter, which have at least one comment [child] record.

There is a straight table with dimensions of Incident number and quarter start of the Incident create date.

The expression I'm attempting is this:  sum( if ( count ( Comments ) > 0,1,0) ) 

And it works without the sum - using only the "if" shows a 1 and a zero just fine.  it's when I try to add them by quarter that I get no results.

Any help is appreciated.

Thanks,

1 Solution

Accepted Solutions
Jason_Michaelides
Partner - Master II
Partner - Master II

Try this:

Count({<IncidentNo={"=Count(CommentNo)>0"}>}DISTINCT IncidentNo)

See attached.

Hope this helps,

Jason

View solution in original post

4 Replies
Jason_Michaelides
Partner - Master II
Partner - Master II

Try this:

Count({<IncidentNo={"=Count(CommentNo)>0"}>}DISTINCT IncidentNo)

See attached.

Hope this helps,

Jason

Not applicable
Author

That worked!  Thanks also for setting up that whole example file.

Now another question, where is the definition of the quarters in that nifty format - "Jan-Mar 2011"  ?

Thanks again!

Jason_Michaelides
Partner - Master II
Partner - Master II

QuarterName(DateField) in the script.

Not applicable
Author

Thanks!