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 distinct values within the same table

I am loading a table (Y_Sent) that has numerous attributes. Including: 'SDSID', 'Filename' and 'Direction'. With multiple SDS IDs appearing in the table, I'd like to include a count of Filenames against each SDS ID as part of my load script.

Could somebody kindly assist?

Thanks

JW

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Maybe like

Y_Sent:

LOAD

     SDSID,

     Filename,

     Direction

FROM ....;

LEFT JOIN (Y_Sent) LOAD

                 SDSID,

                 count(distinct Filename) as FileCount

resident Y_Sent

                  group by SDSID;

View solution in original post

2 Replies
swuehl
MVP
MVP

Maybe like

Y_Sent:

LOAD

     SDSID,

     Filename,

     Direction

FROM ....;

LEFT JOIN (Y_Sent) LOAD

                 SDSID,

                 count(distinct Filename) as FileCount

resident Y_Sent

                  group by SDSID;

sushil353
Master II
Master II

Try this:

first of all get the count of each file using groupby function. and after that do a inner join with the main table.

load

count(filenames)

from main_table

groupby SDS ID

inner join main_table

load * from main_table

Please explain your issue a bit more..

HTH

Sushil