Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
wunderch
Creator
Creator

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
jagan
Luminary Alumni
Luminary Alumni

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.

View solution in original post

5 Replies
jagan
Luminary Alumni
Luminary Alumni

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
Partner - Specialist III
Partner - Specialist III

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

jagan
Luminary Alumni
Luminary Alumni

Hi,

If you use Left Join records will be duplicated.

Regards,

Jagan.

wunderch
Creator
Creator
Author

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

jagan
Luminary Alumni
Luminary Alumni

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.