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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Count per unique record

Another question:  I have two tables with a one to many relationship.  I want a count from the table where there is only one record and a sum on the table with many records.  How do I do that? 

1 Reply
Sokkorn
Master
Master

Hi,

Suppose that you have two table below

1. Invoice header:

InvCustomer
1A
2B
3C

2. Invoice details

InvItemAmount
1I00110
1I00220
1I00330
2I00140
2I00250

So you link both table via [Invoice header],[Inv]=[Invoice details].[Inv]

From this we will got one to many relationship.

Now try to create Straight table with

     1. Dimension: Inv and Customer

     2. Expression

          a. Count(Inv)

          b. Sum(Amount)

It should give you

InvCustomerCount(Inv)Sum(Amount)
1A160
2B190
3C10

Regards,

Sokkorn