Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
upaliwije
Creator II
Creator II

JOINING TABLE

Hi friends

I have two following tables. Table one contain data relating claims paid in respect of insurance polices. Table 2 has Insurance premium collected on policies for which claims have been paid (given in table one)

TABLE 1
RISKPOLICY_NOPOLICY_PERIODCLAIM_NOPAID_AMOUNT
18-9714AB00101A000656Sep-10 - Sep-11CLAB1A110000414,000
AB00101A000656Sep-10 - Sep-11CLAB1A110000604,250
AB00101A000656Sep-10 - Sep-11CLAB1A1100005911,100
AB00101A000656Sep-10 - Sep-11CLAB1A110000929,200
AB00101A000656Sep-10 - Sep-1128,550
AB00101A000656Total28,550
19-6047AB00081A000495Nov-08 - Nov-09CLAB1A0900002210,800
AB00081A000495Nov-08 - Nov-09CLAB1A090000454,000
AB00081A000495Nov-08 - Nov-09CLAB1A090000556,000
AB00081A000495Nov-08 - Nov-0920,800
AB00081A000495Nov-09 - Nov-10CLAB1A1000003737,400
AB00081A000495Nov-09 - Nov-1037,400
AB00081A000495Nov-10 - Nov-11CLAB1A110000807,450
AB00081A000495Nov-10 - Nov-117,450
AB00081A000495Nov-11 - Nov-12CLAB1A1200002120,000
AB00081A000495Nov-11 - Nov-1220,000
AB00081A000495Nov-12 - Nov-13CLAB1A130000106,000
AB00081A000495Nov-12 - Nov-13CLAB1A1300005617,500
AB00081A000495Nov-12 - Nov-13CLAB1A1300014215,000
AB00081A000495Nov-12 - Nov-1338,500
AB00081A000495Nov-13 - Nov-14CLAB001A1400012813,950
AB00081A000495Nov-13 - Nov-1413,950
AB00081A000495Nov-14 - Nov-15CLAB001A150000137,450
AB00081A000495Nov-14 - Nov-157,450
AB00081A000495Total145,550
TABLE 2
RISKPOLICY_NOPOLICY_PERIODPREMIUM
18-9714AB00101A000656Sep-10 - Sep-1124,000
19-6047AB00081A000495Nov-08 - Nov-0912,000
AB00081A000495Nov-09 - Nov-1013,500
AB00081A000495Nov-11 - Nov-1220,000
AB00081A000495Nov-12 - Nov-1330,000
AB00081A000495Nov-14 - Nov-1521,000

I want to join these tow tables to obtain the report as follows.

RISKPOLICY_NOPOLICY_PERIODCLAIM_NOPAID_AMOUNTPremium
18-9714AB00101A000656Sep-10 - Sep-11CLAB1A110000414,00024000
AB00101A000656Sep-10 - Sep-11CLAB1A110000604,250
AB00101A000656Sep-10 - Sep-11CLAB1A1100005911,100
AB00101A000656Sep-10 - Sep-11CLAB1A110000929,200
AB00101A000656Sep-10 - Sep-1128,550
AB00101A000656Total28,550
19-6047AB00081A000495Nov-08 - Nov-09CLAB1A0900002210,80012000
AB00081A000495Nov-08 - Nov-09CLAB1A090000454,000
AB00081A000495Nov-08 - Nov-09CLAB1A090000556,000
AB00081A000495Nov-08 - Nov-0920,800
AB00081A000495Nov-09 - Nov-10CLAB1A1000003737,40013500
AB00081A000495Nov-09 - Nov-1037,400
AB00081A000495Nov-10 - Nov-11CLAB1A110000807,450
AB00081A000495Nov-10 - Nov-117,450
AB00081A000495Nov-11 - Nov-12CLAB1A1200002120,00020000
AB00081A000495Nov-11 - Nov-1220,000
AB00081A000495Nov-12 - Nov-13CLAB1A130000106,00030000
AB00081A000495Nov-12 - Nov-13CLAB1A1300005617,500
AB00081A000495Nov-12 - Nov-13CLAB1A1300014215,000
AB00081A000495Nov-12 - Nov-1338,500
AB00081A000495Nov-13 - Nov-14CLAB001A1400012813,950
AB00081A000495Nov-13 - Nov-1413,950
AB00081A000495Nov-14 - Nov-15CLAB001A150000137,45021000
AB00081A000495Nov-14 - Nov-157,450
AB00081A000495Total145,550

Please note that premium should be shown in one row although There are several rows for claim payment. Pls advise me which type of join a I should have in my data model in order to achieve above output

1 Solution

Accepted Solutions
swuehl
MVP
MVP

You can maybe use a MAPPING table created from the first table:

TABLE1:

LOAD

     RISK,

     POLICY_NO,

     POLICY_PERIOD,

     CLAIM_NO,

     PAID_AMOUNT

FROM Table1Source;

RISKMAP:

MAPPING LOAD POLICY_NO, RISK RESIDENT TABLE1;

CONCATENATE (TABLE1)

LOAD ApplyMap('RISKMAP', POLICY_NO,'no mapping found') as RISK,

         POLICY_NO,

         POLICY_PERIOD,

        PREMIUM

FROM Table2Source;

Or could a POLICY_NO have more than 1 RISK?

View solution in original post

4 Replies
swuehl
MVP
MVP

Have you considered just concatenating the two tables using CONCATENATE LOAD prefix on the second table?

This will not reproduce the table on the bottom of your post, but might fulfill your analysis requirements as well (e.g. filtering on RISK, POLICY_NO or POLICY_PERIOD, and aggregating your PAID_AMOUNT and Premium correctly.

upaliwije
Creator II
Creator II
Author

Thanks

Sorry I have made a mistake . The Risk field is not available in my second table. Therefore if I do concatenate I can not filter data on Risk field that is my main requirement. Pls advise

swuehl
MVP
MVP

You can maybe use a MAPPING table created from the first table:

TABLE1:

LOAD

     RISK,

     POLICY_NO,

     POLICY_PERIOD,

     CLAIM_NO,

     PAID_AMOUNT

FROM Table1Source;

RISKMAP:

MAPPING LOAD POLICY_NO, RISK RESIDENT TABLE1;

CONCATENATE (TABLE1)

LOAD ApplyMap('RISKMAP', POLICY_NO,'no mapping found') as RISK,

         POLICY_NO,

         POLICY_PERIOD,

        PREMIUM

FROM Table2Source;

Or could a POLICY_NO have more than 1 RISK?

Anonymous
Not applicable

Hi,

try this if that can help you.

Regards