Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
sureshbaabu
Creator III
Creator III

Aggregate function at script level - using QVD

Hello,

I have a requirement to apply a SUM function on certain columns  - group by at a different column.

So, is it possible to use a Aggregate function at script level while importing data from a QVD file. Please share your thoughts.

NOTE: I can't do the aggregation while creating the QVD file (connecting to Database) ;since the columns are coming from different tables

Eg:

Original Script: Load A,B,C,D from test.qvd

Required: Load A, Sum(B) as B1, Sum(C) as C1,D from test.qvd group by A;

Thanks,

Suresh

1 Solution

Accepted Solutions
fernando_tonial
Employee
Employee

Hi Suresh,

yes it is possible, you should put the group by all fields that are no aggregate function.

Load A, Sum(B) as B1, Sum(C) as C1,D from test.qvd group by A,D;

Best Regards.

Tonial.

Don't Worry, be Qlik.

View solution in original post

7 Replies
fernando_tonial
Employee
Employee

Hi Suresh,

yes it is possible, you should put the group by all fields that are no aggregate function.

Load A, Sum(B) as B1, Sum(C) as C1,D from test.qvd group by A,D;

Best Regards.

Tonial.

Don't Worry, be Qlik.
nagaiank
Specialist III
Specialist III

Yes, the following script will work.

Load A, Sum(B) as B1, Sum(C) as C1, Sum(D) as D1 from test.qvd group by A;

sureshbaabu
Creator III
Creator III
Author

Hello Tonial,

Thanks for your response. I tested with a sample data and it works having all the un-aggregated columns in group by,

But In my real senario, I have close to 30 cloums that doest have any aggregate function. So, would you suggest using all 30 columns in the group by. Please share your thoughts.

Thank you!!!

sureshbaabu
Creator III
Creator III
Author

Hello Krishnamoorthy,

Thanks for the Response. You Script is correct too, when I have my column D as numeric.

But, few of my columns are having characters, So, I believe having them on Group by will work.

Thanks

fernando_tonial
Employee
Employee

Hi Suresh,


Yes, it works the same as SQL.
You need to put all columns without aggregate function in group by.

Best Regards.

Tonial.

Don't Worry, be Qlik.
sureshbaabu
Creator III
Creator III
Author

Thanks a lot for the clarification.

Not applicable

hi, Tonial

how to this qvd file in right

Untitled.png