Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Support Cases coming to Qlik Community Oct. 4! Start chats, open cases, explore resources: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Script

Hi everyone,

i need to get the count of two columns from same table and put it into separate table.

For this i have to write a script so please help me on this.

Thanks in advance

Regards,

Sudha Banakar

3 Replies
MayilVahanan

Hi

Try like this

MainTable:

Load ProductID, Category, Product From tablename;

Table1:

Load ProductID, Count(Product) As ProductCount Resident MainTable Group by ProductID;

Table2:

Load ProductID, Count(Category) As CategoryCount Resident MainTable Group by ProductID;

Edit:

Forget to give group by

Thanks & Regards,
Mayil Vahanan R
sujeetsingh
Master III
Master III

Hi,

If it is to be added to another table then go for join or concat

Else just you want to get it in another table with same data then the one provided by Mayil is best

Not applicable
Author

Hello Sudha,

You can try below, But you should have a Key field to join these counts to rest of the data model and for that you would need to use the Group By Clause.

Maintable:

LOAD * INLINE [

    ProductID, Category, IsTraded, IsShipped

    123, Iphone, 0, 0

    124, samsung, 1, 1

    125, Iphone, 1, 0

    126, Iphone, 1, 1

    127, Iphone, 1, 1

];

CountTable:

LOAD

sum(IsTraded) as TotalTraded,

sum(IsShipped) as TotalShipped

Resident Maintable;

Thanks,

ASINGH