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: 
martynlloyd
Partner - Creator III
Partner - Creator III

Problem counting headers

I have two tables: Claim Headers, and Referrals, Referrals has a many-to-one releationship with the Headers, keys are DealerID and Claim Number.

I need to calculate Total No. of Referrals / Total No. Claims.

The problem with the script below is that if a claim has more than one rferral, the header gets counted more than once - I could make a second pass of the table and count distinct claim numbers, but is there a better way?

ClaimStats2T:
LOAD
DealerID, // key
[Claim Number], // key
KPIYear,
KPIMonth,
CountClaims // is always 1, used to sum
Resident ClaimFacts
;
Left Join
LOAD
DealerID, // key
[Claim Number], //key
ReferredDate,
1 as ClaimReferred
;
SQL

...

Regards,

Marty.

1 Reply
tresesco
MVP
MVP

Would not   =Count(Distinct ..  be an option?