Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

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.

wunderch
New Contributor II

Sales Date A select Sales from Date B

Hi,

I have the following problem:

I have a Date A and a Date B that compares to Date A and Sales with Date A and Date B.

Now I want to select Date A und and get automatically the Sales from Date A and Date B.

For example the following qvw with Inline-Data.

I tried with variable, set analysis and alternate state, but nothing was the right thing?!

Hope someone can help me!

Thanks

Christian

1 Solution

Accepted Solutions
MVP & Luminary
MVP & Luminary

Re: Sales Date A select Sales from Date B

Hi,

Try this script

DateASales:

Load * inline

[DateA, Sales

'01.06.2015', 100,

'02.06.2015',  50,

'03.06.2015', 200,

'04.06.2015', 150,

'05.06.2015', 200,

'06.06.2015', 300,

'07.06.2015', 250,

'02.06.2014', 180,

'03.06.2014', 120,

'04.06.2014', 100,

'05.06.2014', 220,

'06.06.2014', 400,

'07.06.2014', 320,

'08.06.2014', 500];

Date:

Load * inline

[DateA, DateB,

'01.06.2015', '02.06.2014',

'02.06.2015', '03.06.2014',

'03.06.2015', '04.06.2014',

'04.06.2015', '05.06.2014',

'05.06.2015', '06.06.2014',

'06.06.2015', '07.06.2014',

'07.06.2015', '08.06.2014'];

DateBSales:

Left Keep(Date)

LOAD

DateA AS DateB,

Sales AS SalesB

RESIDENT DateASales;

In chart:

Dimensions : DateA, DateB

Expression :

SalesA = Sum(sales)

SalesB = Sum(salesB)

Regards,

Jagan.

5 Replies
MVP & Luminary
MVP & Luminary

Re: Sales Date A select Sales from Date B

Hi,

Try this script

DateASales:

Load * inline

[DateA, Sales

'01.06.2015', 100,

'02.06.2015',  50,

'03.06.2015', 200,

'04.06.2015', 150,

'05.06.2015', 200,

'06.06.2015', 300,

'07.06.2015', 250,

'02.06.2014', 180,

'03.06.2014', 120,

'04.06.2014', 100,

'05.06.2014', 220,

'06.06.2014', 400,

'07.06.2014', 320,

'08.06.2014', 500];

Date:

Load * inline

[DateA, DateB,

'01.06.2015', '02.06.2014',

'02.06.2015', '03.06.2014',

'03.06.2015', '04.06.2014',

'04.06.2015', '05.06.2014',

'05.06.2015', '06.06.2014',

'06.06.2015', '07.06.2014',

'07.06.2015', '08.06.2014'];

DateBSales:

Left Keep(Date)

LOAD

DateA AS DateB,

Sales AS SalesB

RESIDENT DateASales;

In chart:

Dimensions : DateA, DateB

Expression :

SalesA = Sum(sales)

SalesB = Sum(salesB)

Regards,

Jagan.

Gabriel
Valued Contributor III

Re: Sales Date A select Sales from Date B

Hi,

In this instance why not use LEFT JOIN and have a single table which holds Date A, Sales A, Date B and Sales B

MVP & Luminary
MVP & Luminary

Re: Sales Date A select Sales from Date B

Hi,

If you use Left Join records will be duplicated.

Regards,

Jagan.

wunderch
New Contributor II

Re: Sales Date A select Sales from Date B

Hi Jagan,

thanks for your quick Answer. It works fine,

But is there a chance to get the same result without duplicate the 'DateASales'-Table?

Regards

Christian

MVP & Luminary
MVP & Luminary

Re: Sales Date A select Sales from Date B

I think this is the better approach, if you don't want that table use Left Join instead of Left Keep, I think this should also work.

If you got the answer please close this thread by giving Correct & Helpful Answers to the posts which helps you.

Regards,

Jagan.