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: 
Sunil_Kenth
Former Employee
Former Employee

Group data in the load script

Hi all,

I need some help with some syntax on how to group data together in the load script.

The field in my table is called Supplier_Category and I would like to group entries in this field that = 'Company A', 'Company B' and 'Company C' and then name this group as 'Partners'.

Thanks for your help in advance.

Sunil

3 Replies
jedgson
Creator
Creator

Load

     Supplier_Category as Partners,

     Max(1) as Temp

From YourDataSource

Group By Supplier_Category

Where

     Supplier_Category = 'Company A' or

     Supplier_Category = 'Company B' or

     Supplier_Category = 'Company B'

;

Any addtional fields added in to the Load statement must also be added to the group by statement.

Jay

Sunil_Kenth
Former Employee
Former Employee
Author

Hi Jay,

Thanks for your prompt response.

I think I probably didn’t explain clearly what I wanted.  I still want the field to be called Supplier_Category but I need to group/categorise/rename certain values (Company A, Company B, etc) within the field as ‘Partners’.

Something like:

if

((Supply_Category)='Company A', & if(Supply_Category)='Company B') as Partners

Is this possible in the load script?

Thanks,

Sunil

Sokkorn
Master
Master

Hi Sunil,

This one should have a master data for group name. If it doesn't have, you need to load with a hard script like this

[TableName]:

LOAD

    CompanyField,

    IF(CompanyField='Company A' OR CompanyField='Company B' OR CompanyField='Company C','Partners','-')    AS [Group]

FROM YourTable

Regards,

Sokkorn