G
Guest
Hi -
I used the prior (Jan 13 and 14) thread to try to get a
ranking of Sales in our Stores. What I want is the NUMBER
the store is Ranked, so I can print it on another report.
For example, one Department in one store may rank 4th in
the chain (which I show on the report via sorting/grouping
descending order of sales for the dept), but I want to
show that the store in which the dept ranked 4th was 17th
in the chain OVERALL YTD sales. So, I just want to PRINT
the RANK # associated with the descending order of YTD
sales.
I tried to do a MAKE TABLE query and create and ID# on
each record, but I couldn't do that. So, I tried this for
Ranking. In the RANK field, I get all "1", not 1-18, as I
need.
Code:
SELECT T.SalesDate, T.[YTDTY Sales], T.StoreNum, (SELECT
COUNT(*)
FROM [T:Store Sales Data] AS T1
WHERE T1.[YTDTY Sales] = T.[YTDTY Sales]
AND T1.SalesDate = T.SalesDate) AS RANK
FROM [T:Store Sales Data] AS T
WHERE (((T.SalesDate)=[Enter Sales Date]) AND ((T.StoreNum)
<>99))
ORDER BY T.[YTDTY Sales] DESC;
Thanks - I am the only "IT" person in this techno-
challenged and techno-phobic company, so I have no one to
ask!
Sara
I used the prior (Jan 13 and 14) thread to try to get a
ranking of Sales in our Stores. What I want is the NUMBER
the store is Ranked, so I can print it on another report.
For example, one Department in one store may rank 4th in
the chain (which I show on the report via sorting/grouping
descending order of sales for the dept), but I want to
show that the store in which the dept ranked 4th was 17th
in the chain OVERALL YTD sales. So, I just want to PRINT
the RANK # associated with the descending order of YTD
sales.
I tried to do a MAKE TABLE query and create and ID# on
each record, but I couldn't do that. So, I tried this for
Ranking. In the RANK field, I get all "1", not 1-18, as I
need.
Code:
SELECT T.SalesDate, T.[YTDTY Sales], T.StoreNum, (SELECT
COUNT(*)
FROM [T:Store Sales Data] AS T1
WHERE T1.[YTDTY Sales] = T.[YTDTY Sales]
AND T1.SalesDate = T.SalesDate) AS RANK
FROM [T:Store Sales Data] AS T
WHERE (((T.SalesDate)=[Enter Sales Date]) AND ((T.StoreNum)
<>99))
ORDER BY T.[YTDTY Sales] DESC;
Thanks - I am the only "IT" person in this techno-
challenged and techno-phobic company, so I have no one to
ask!
Sara