Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

What's wrong with my script??

Dear QV users,

I am trying to group my table. Before doing this I would like to ad sum() to some fields that are going to be grouped in values. See attachment 'forum qv'. When running this script I am receiving the following script failure (see attachement 'forum qv failure') Cann someone help me explain what is wrong here??

regards,

Aissam

1 Solution

Accepted Solutions
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

     You must use group by statement when you use sum() in load.

     You must include all the field except the sum() in your group statement.

     Just like below.

 

    Load

    A,

    B,

    sum(c) as C

    Resident XXX

    Group by A,B;

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!

View solution in original post

7 Replies
Not applicable
Author

I don't think you can use sum() in the script...

Not applicable
Author

Hi,

Have you given the group by clause in your script?

Not applicable
Author

Not yet, trying first to create the sum function..

jonathandienst
Partner - Champion III
Partner - Champion III

Aissam

You must use Group By with an aggregate function like sum(). Use the following syntax

LOAD Key,

     Value,

     Sum(Amount) AS TotalAmount

Resident MyTable

Group by Key, Value;

The group by statement should contain all the fields in the query that are not in an aggregate function. The field names must be the source table names.

Hope that helps

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

     You must use group by statement when you use sum() in load.

     You must include all the field except the sum() in your group statement.

     Just like below.

 

    Load

    A,

    B,

    sum(c) as C

    Resident XXX

    Group by A,B;

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Not applicable
Author

Thanks guys,

It worked.

With kind regards,

Aissam

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

    Can you please mark this post as Answered. So that Qlikview Group can look at the other post too.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!