Query Help Needed

C

carl

I posted a similar question a few days ago but thought I would re-post with a
"better" example.

My Data looks like this:

TradeDate Trader Sales Product
16-Mar Bob 50 ABC
16-Mar Joe 50 ABC
16-Mar Bob 25 DEF
16-Mar Joe 75 DEF
16-Mar Bob 50 GHI
16-Mar Joe 25 GHI
16-Mar Jim 25 GHI
17-Mar Bob 100 DEF

I need a qry that will show me the % of total sales each trader had for each
product for each day. The table I am trying to produce would like something
like this:

TradeDate Product Bob Joe Jim
16-Mar ABC 50% 50% 0%
16-Mar DEF 25% 75% 0%
16-Mar GHI 50% 25% 25%
17-Mar ABC 100% 0% 0%
17-Mar DEF 0% 100% 0%


If this is possible, I would appreciate some examples of qry's that I could
use.

Thank you in advance.
 
J

Jerry Whittle

Check out crosstab queries in Help. There's a crosstab query wizard, but it
may take a few tries to get it right.
 
C

carl

Thanks for pointing me to the help area.

Unfortunately I still cannot put a qry together that can accomplish what I
need to do.

Can you provide an example of a qry that would work for me ?
 
J

Jerry Whittle

TRANSFORM Sum(Sales) AS SumOfSales
SELECT TradeDate,
Product,
Sum(Sales) AS [Total Of Sales]
FROM Trades
GROUP BY TradeDate, Product
PIVOT Trader;

Replace "Trades" with the correct table name.

The above won't show the % sign. It also leaves a null instead of 0. Still
it's a good start.
 

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

Top