Stacked graph data filter (1 Viewer)

vbaInet

AWF VIP
Local time
Today, 17:41
Joined
Jan 22, 2010
Messages
26,374
You may have missed my last post Bob.
 

dutchbob

Registered User.
Local time
Today, 18:41
Joined
Jun 16, 2015
Messages
17
This query separates the data by looking for the productnumbers with selling data before 2013

SELECT [RoI Actual].[Number]
FROM [RoI Actual]
WHERE ((([RoI Actual].FiscalYear)<#1/1/2013#));

This query searches the complement of those data points and makes a list of the product number of products launched after 2013

SELECT DISTINCT [RoI Actual].Number
FROM [RoI Actual] LEFT JOIN SeparateTheDate ON [RoI Actual].[Number] = SeparateTheDate.[Number]
WHERE (((SeparateTheDate.Number) Is Null));

This generates the same list with the before numbers

SELECT DISTINCT SeparateTheDate.Number
FROM SeparateTheDate;

And these two generate the linkage of the numbers in the list with the data in the original table

SELECT [RoI Actual].[Number], [RoI Actual].FiscalYear, [RoI Actual].SalesEuros, [RoI Actual].Category
FROM After2013 INNER JOIN [RoI Actual] ON [After2013].[Number]=[RoI Actual].[Number];

SELECT Before2013.Number, [RoI Actual].FiscalYear, [RoI Actual].SalesEuros, [RoI Actual].Category
FROM Before2013 INNER JOIN [RoI Actual] ON Before2013.[Number] = [RoI Actual].[Number];
 

vbaInet

AWF VIP
Local time
Today, 17:41
Joined
Jan 22, 2010
Messages
26,374
I'm sure that you can do all this in one query, but to answer you original question you use a UNION query to combine both:
Code:
SELECT [RoI Actual].[Number], [RoI Actual].FiscalYear, [RoI Actual].SalesEuros, [RoI Actual].Category
FROM After2013 INNER JOIN [RoI Actual] ON [After2013].[Number]=[RoI Actual].[Number];
[COLOR="Blue"]UNION ALL[/COLOR]
SELECT Before2013.Number, [RoI Actual].FiscalYear, [RoI Actual].SalesEuros, [RoI Actual].Category
FROM Before2013 INNER JOIN [RoI Actual] ON Before2013.[Number] = [RoI Actual].[Number];
Just ensure that the fields on both sides match.
 

dutchbob

Registered User.
Local time
Today, 18:41
Joined
Jun 16, 2015
Messages
17
I will try this, thank you. I am a rookie in Access, this is the first project with it and so far so good.
 

dutchbob

Registered User.
Local time
Today, 18:41
Joined
Jun 16, 2015
Messages
17
This is excelent, but I only need an indicator that tells me which products are launched before and which after the set date. The rest is excellent.
 

vbaInet

AWF VIP
Local time
Today, 17:41
Joined
Jan 22, 2010
Messages
26,374
Words like Number and Category should be enclosed in square brackets because I suspect that both are (or at least Number is a) reserved keyword(s). And avoid spaces in your names too.
 

dutchbob

Registered User.
Local time
Today, 18:41
Joined
Jun 16, 2015
Messages
17
Thank you! I wish you a nice day, problem solved.
 

Users who are viewing this thread

Top Bottom