Regrouping Sales numbers per Year + Combo Graph (1 Viewer)

ggooss

New member
Local time
Yesterday, 18:54
Joined
Nov 19, 2020
Messages
10
Hello All,

Could you please give me a push in the right direction?
1622081854419.png


Thanks,
Greg
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 18:54
Joined
Oct 29, 2018
Messages
21,489
Have you tried using a crosstab query?
 

plog

Banishment Pending
Local time
Yesterday, 20:54
Joined
May 11, 2011
Messages
11,653
2 criticism points...

1. [Month] is a poor field name because it is a reserved word (https://docs.microsoft.com/en-us/office/troubleshoot/access/reserved-words). You should not name fields/objects with words on that list--makes writing code and qeury just a little more difficult.

2. Dates should be stored with a Date/Time field. Even though those are just month/years, you should think about changing it to a Date/Time and then just storing the first date of the month/year (e.g. 2/1/2021, 3/1/2021, etc.). Doing that allows you to use the built-in date functions of Access (https://www.techonthenet.com/access/functions/index.php) which would make this easier.

And 2 constructive points..

1. Use the Mid() function (https://www.techonthenet.com/access/functions/string/mid.php) to split out your [Month] field into month and year in a query.

2. Then convert that query to a crosstab(https://support.microsoft.com/en-us...ab-query-8465b89c-2ff2-4cc8-ba60-2cd8484667e8). That will let you convert the Year values to column names and put values beneath them.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 09:54
Joined
May 7, 2009
Messages
19,247
see Query2
 

Attachments

  • Database2.accdb
    420 KB · Views: 81

ggooss

New member
Local time
Yesterday, 18:54
Joined
Nov 19, 2020
Messages
10
Thanks a lot all. The crosstab query is working.
Now i was doing this also so i could create a combo graph.
What would be the trick in order to allocate last year's sales to the Primary axis and current sales to Secondary axis please?

So you can visually see the difference in sales for each month.
1622663547178.png



So it shows like that:
1622663744665.png



Thanks,
Greg
 

Users who are viewing this thread

Top Bottom