Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Chart help

Status
Not open for further replies.

amna77

Programmer
May 27, 2003
69
GB
Hi, actully i am trying to create a chart. I have a data for whole year in my append table, now what I want to do is, I want to create a chart. Chart will be a bar graph, but in there i want to show Quarters first, and then 3 months from the last quater and then 4 weeks from last month.
for example first i'll have 4 bars for qtr1 through qtr4, and then 3 bars for Oct, Nov, Dec, and then 4 bars for weeks of december.
Can please some one help me.
I shall be thanfull to you.

Thanks
 
You could do this with a union query that includes three selects that group by Quarter then Month then Week.

Duane
MS Access MVP
[green]Ask a great question, get a great answer.[/green]
[red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
[blue]Ask me about my grandson, get a grand answer.[/blue]
 
Thanks for reply, one question how would I make a union query? please thanks
 
You would first make three separate queries with the same number of columns and data types:
=qtotByQuarter=======
SELECT 1 as Seq,
"Q" & Format([SalesDate],"Q") as Period,
Sum([Sales]) as TotalSales
FROM tblSales
WHERE Year(SalesDate)=Year(Date())
GROUP BY 1, "Q" & Format([SalesDate],"Q");

=qtotByMth=======
SELECT 2 as Seq,
"M" & DateDiff("m", [SalesDate],Date()) as Period,
Sum([Sales]) as TotalSales
FROM tblSales
WHERE DateDiff("m", [SalesDate],Date()) <= 3
GROUP BY 2, "M" & DateDiff("m", [SalesDate],Date());

=qtotByWeek=======
SELECT 3 as Seq,
"W" & DateDiff("w", [SalesDate],Date()) as Period,
Sum([Sales]) as TotalSales
FROM tblSales
WHERE DateDiff("w", [SalesDate],Date()) <= 4
GROUP BY 3, "W" & DateDiff("w", [SalesDate],Date())

Then Union them in a fourth query:

SELECT Seq, Period, TotalSales
FROM qtotByQuarter
UNION ALL
SELECT Seq, Period, TotalSales
FROM qtotByMth
UNION ALL
SELECT Seq, Period, TotalSales
FROM qtotByWeek


Duane
MS Access MVP
[green]Ask a great question, get a great answer.[/green]
[red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
[blue]Ask me about my grandson, get a grand answer.[/blue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top