Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Not applicable

Consolidating values in script

Bit of a noob question - this probably should be really simple, but it's got me stuck!!

As a quick example of my problem, let's say I've loaded Table1:

SalesPersonSales
A10
B15
C3
D8

and Table2:

RegionSalesPerson
XA
XB
YC
YD

all I want to do in my script is to build a new Table3: that shows this:

RegionSales
X25
Y11

Obviously easy when using a chart object, but I need to do it all in the script as it's intended to run overnight on a schedule and finish by outputting Table3 to a text file ready to be picked up by another application.

I've not posted the full code as there's a helluva lot more in there, however everything else works fine so no point complicating things - I've just got this little problem to solve which probably comes down to just using the right function!

Thanks in advance for any help!

1 Solution

Accepted Solutions
gussfish
Contributor II

Re: Consolidating values in script

Something like this should do the trick.

JoinedTables:

LOAD

SalesPerson

Region

resident Table2;

LEFT JOIN

LOAD

SalesPerson,

Sales

resident Table1;

Table3:

LOAD

Region,

SUM(Sales)

resident JoinedTables

GROUP BY Region;

DROP TABLE JoinedTables;

2 Replies
gussfish
Contributor II

Re: Consolidating values in script

Something like this should do the trick.

JoinedTables:

LOAD

SalesPerson

Region

resident Table2;

LEFT JOIN

LOAD

SalesPerson,

Sales

resident Table1;

Table3:

LOAD

Region,

SUM(Sales)

resident JoinedTables

GROUP BY Region;

DROP TABLE JoinedTables;

Not applicable

Re: Consolidating values in script

Cheers mate - works perfectly!

Understand it now too - I was on the right track using GROUP BY, but it was the aggregation of the 'Sales' field I was missing in my script. Knew it would be something simple enough!

Jay