Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

Sum and Group by

Hi,

I am very new in Qlikview development.

I am trying to do a 'Group by' based on [sales year] and [sales month] to find the monthly Sales of each customer in Script.

But I am getting 'Invalid expression' error on following script.

CustomerMonthlySales:

LOAD

[Customer Number],

[VE Posting Year] AS SalesYear,

[VE Posting Month] AS SalesMonth,

SUM([Sales Amount (Actual)]) AS MonthlySales

Resident Fact Group BY [VE Posting Year],[VE Posting Month]

Tags (4)
4 Replies
fernando_tonial
Valued Contributor

Re: Sum and Group by

Hi, You need put all field without agregation.

Try this.

CustomerMonthlySales:

LOAD

[Customer Number],

[VE Posting Year] AS SalesYear,

[VE Posting Month] AS SalesMonth,

SUM([Sales Amount (Actual)]) AS MonthlySales

Resident Fact

Group BY [Customer Number],[VE Posting Year],[VE Posting Month];

Best Regards.

Tonial.

Not applicable

Re: Sum and Group by

Thank you very much Tonial. That's worked....

Re: Sum and Group by

You have to include all the field in the Group by that you use

CustomerMonthlySales:

LOAD

[Customer Number],

[VE Posting Year] AS SalesYear,

[VE Posting Month] AS SalesMonth,

SUM([Sales Amount (Actual)]) AS MonthlySales

Resident Fact Group BY

[Customer Number],[VE Posting Year],[VE Posting Month];

Regards

Anand

Re: Sum and Group by

Hi,

If you need to omit group by then below

CustomerMonthlySales:

LOAD

[Customer Number],

only([VE Posting Year]) AS SalesYear,

only([VE Posting Month]) AS SalesMonth,

SUM([Sales Amount (Actual)]) AS MonthlySales

Resident Fact Group BY

[Customer Number];

Regards

ASHFAQ

Community Browser