Multi level (Subgrouped) TOP query

P

Phil

OK. I can run a query that will give me say, the top three
salespersons, sorted by sales, for the month of March.

I can run another one for April. One for May, one for June.

I want to run a single report, that will list top 3 for each "groupby."

Sort it by month and sales, and get.

January Fred 5000
January Joan 4000
January John 3000
February Joan 6000
February Fred 5000
February John 3500
....


how to do?

Thanx for any assistance.
 
G

Guest

Hello Allen. I was in need of this same concept and option 1 with the top
values per group worked perfectly. Here is the issue. I am trying to use
this as a subreport for a main report that contains many unrelated items.
The reference to the report in the query does not work when this is added as
a subreport. How could I get this to work properly. Maybe this option isn't
the way to go for what I am attempting to do. Please let me know if you have
any ideas. I already tried changing the reference in the query to the
following: Reports!MainReport!subreport.field

Please let me know if you have the time. Thank you.
 
A

Allen Browne

Subreports are not open in their own right, so you might try a reference
such as:
Reports.[Report1].[Sub1].Report.[Text0]
where:
- Report1 is the name of the main report;
- Sub1 is the name of the subreport control;
- Text0 is the name of the text box in the subreport.

In most cases, you should be able to use a TOP N query as the source for the
subreport without all that, just by using the
LinkMasterFields/LinkChildFields of the subreport control.

Other alternative approaches:
http://support.microsoft.com/kb/210039/en-us
 
G

Guest

That worked great. Thanks for the quick reference lesson. I really
appreciate your quick response.

Allen Browne said:
Subreports are not open in their own right, so you might try a reference
such as:
Reports.[Report1].[Sub1].Report.[Text0]
where:
- Report1 is the name of the main report;
- Sub1 is the name of the subreport control;
- Text0 is the name of the text box in the subreport.

In most cases, you should be able to use a TOP N query as the source for the
subreport without all that, just by using the
LinkMasterFields/LinkChildFields of the subreport control.

Other alternative approaches:
http://support.microsoft.com/kb/210039/en-us

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

shoe said:
Hello Allen. I was in need of this same concept and option 1 with the top
values per group worked perfectly. Here is the issue. I am trying to use
this as a subreport for a main report that contains many unrelated items.
The reference to the report in the query does not work when this is added
as
a subreport. How could I get this to work properly. Maybe this option
isn't
the way to go for what I am attempting to do. Please let me know if you
have
any ideas. I already tried changing the reference in the query to the
following: Reports!MainReport!subreport.field

Please let me know if you have the time. Thank you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Help with Crosstab Query 1
checking if month is missing 4
Excel Excel 2010 2
Query Dates via form 1
Month Names 4
Multi-level GROUP BY 6
summary report 2
Query to Include Empty Records 4

Top