Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
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

What's wrong with my script??

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

7 Replies
Not applicable

What's wrong with my script??

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

Not applicable

What's wrong with my script??

Hi,

Have you given the group by clause in your script?

Not applicable

What's wrong with my script??

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

MVP
MVP

Re: What's wrong with my script??

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

What's wrong with my script??

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

Not applicable

What's wrong with my script??

Thanks guys,

It worked.

With kind regards,

Aissam

What's wrong with my script??

Hi,

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

Regards,

Kaushik Solanki

Community Browser