As Instructed this is a new thread regarding my original post: "Select Only 10 Columns Going Back"
I'm sorry for the late response. I've been gathering up information and carefully with as much detail as possible, making clear and straiforward for you.
I need to create 3 new queries based on the queries that you wrote. Each query has a numerical value and a textual value. The new queries are based on the queries with a numerical value. I will show these queries with data to illustrate. As each query displays numerical values going back one month a time for the last 12 months, The numerical values should display cumulative figures going back 3 months back, 6, 9 and 12.
For Mail Service:
[CODE=SQL]SELECT Count(subH.MEQA ) AS [Count],
Format(subD.Mon th,'mmmm yyyy') AS [Month]
FROM (SELECT DateAdd('m',[DateOffset],Forms!Stats.tx tCurrentDate) AS Month
FROM tblDate) AS subD LEFT JOIN
(SELECT [Category] AS [MEQA],
[Month]
FROM tblProtoHistory
WHERE (([Initials]=Forms!Stats.cb Initials)
AND ([PV1]='Mail Service'))) AS subH
ON subD.Month = subH.Month
GROUP BY Format(subD.Mon th,'mmmm yyyy'),
subD.Month
ORDER BY subD.Month DESC;[/CODE]
For PSC:
[CODE=SQL]SELECT Count(subH.MEQA ) AS MEQA_PSC, Format(subD.Mon th,'mmmm yyyy') AS [Month]
FROM [SELECT DateAdd('m',[DateOffset],Forms!Stats.tx tCurrentDate) AS Month
FROM tblDate]. AS subD LEFT JOIN [SELECT [Category] AS [MEQA],
[Month]
FROM tblProtoHistory
WHERE (([Initials]=Forms!Stats.cb Initials)
AND ([PV1]='PSC'))]. AS subH ON subD.Month = subH.Month
GROUP BY Format(subD.Mon th,'mmmm yyyy'), subD.Month
ORDER BY subD.Month DESC;[/CODE]
both these queries comes from this table
The titles for columns PV1 and DateReceived came from the numerous data dumps from which I assembled this query. The value for PV1 here: "Mail Service or "PSC." This is not to be confused with the PV1 column in the Dashboard_PV query below. Sorry for the ambiguity.
For Dashboard_PV:
[CODE=SQL]SELECT Format(subD.Mon th,'mmmm yyyy') AS [Month], nz([pv],0.1) AS PV1
FROM (SELECT DateAdd('m',[DateOffset],Forms!Stats.tx tCurrentDate) AS Month,
Format([Month],'yyyymm') AS YM
FROM tblDate
WHERE [DateOffset]>-12) AS subD LEFT JOIN [SELECT [PV],
[MonthEnd]
FROM Dashboard_PV
WHERE [Initials]=Forms!Stats.cb Initials) AS subH
ON subD.YM = subH.MonthEnd
ORDER BY subD.Month DESC;[/CODE]
This means that, there is a MEQA query for Mail Service, a MEQA query for PSC and a Dashboard query which stands on its own.
Now I need a query that calculates performance percentages going back 3 months, 6 months, 9 months and 12 months. For example, we are looking at data from 3 months back, the current month the last month and the month before, that is, the 3rd month back is summed up and divided. The basic formula is:
For the current month:
This would compose the queries, One for mail service and one for PsC. The last query would the summation of Dashboard_PV + MEQA and then also apply the formulas above.
I wrote this out as clearly as possible, Please let me know if you want me to clarify something-
I was researching about EXCEL as a possibility for these calculations. I wanted to know how you felt about this. Could it work? Could it be viable?
Thanks so much
Richard
I'm sorry for the late response. I've been gathering up information and carefully with as much detail as possible, making clear and straiforward for you.
I need to create 3 new queries based on the queries that you wrote. Each query has a numerical value and a textual value. The new queries are based on the queries with a numerical value. I will show these queries with data to illustrate. As each query displays numerical values going back one month a time for the last 12 months, The numerical values should display cumulative figures going back 3 months back, 6, 9 and 12.
For Mail Service:
Code:
Dates MEQA_Mail_Service April 2008 0 March 2008 0 February 2008 0 January 2008 0 December 2007 1 November 2007 1 October 2007 0 September 2007 1 August 2007 2 July 2007 0 June 2007 0 May 2007 0
Format(subD.Mon th,'mmmm yyyy') AS [Month]
FROM (SELECT DateAdd('m',[DateOffset],Forms!Stats.tx tCurrentDate) AS Month
FROM tblDate) AS subD LEFT JOIN
(SELECT [Category] AS [MEQA],
[Month]
FROM tblProtoHistory
WHERE (([Initials]=Forms!Stats.cb Initials)
AND ([PV1]='Mail Service'))) AS subH
ON subD.Month = subH.Month
GROUP BY Format(subD.Mon th,'mmmm yyyy'),
subD.Month
ORDER BY subD.Month DESC;[/CODE]
For PSC:
Code:
Dates MEQA_PSC April 2008 0 March 2008 0 February 2008 0 January 2008 0 December 2007 0 November 2007 4 October 2007 0 September 2007 0 August 2007 2 July 2007 0 June 2007 0 May 2007 9
FROM [SELECT DateAdd('m',[DateOffset],Forms!Stats.tx tCurrentDate) AS Month
FROM tblDate]. AS subD LEFT JOIN [SELECT [Category] AS [MEQA],
[Month]
FROM tblProtoHistory
WHERE (([Initials]=Forms!Stats.cb Initials)
AND ([PV1]='PSC'))]. AS subH ON subD.Month = subH.Month
GROUP BY Format(subD.Mon th,'mmmm yyyy'), subD.Month
ORDER BY subD.Month DESC;[/CODE]
both these queries comes from this table
Code:
Table Name=[[U]tblProtoHistory[/U]] [I]Field; Type; IndexInfo[/I] memberID; AutoNumber; PK DateReceived; Date/Time Month; Date/Time Initials; Text Name; Text PV1; Text MEQA; Numeric
For Dashboard_PV:
Code:
Month PV1 April 2008 0.1 March 2008 0.1 February 2008 4560 January 2008 76 December 2007 3171 November 2007 2816 October 2007 2126 September 2007 3093 August 2007 3022 July 2007 3070 June 2007 2246 May 2007 2311
FROM (SELECT DateAdd('m',[DateOffset],Forms!Stats.tx tCurrentDate) AS Month,
Format([Month],'yyyymm') AS YM
FROM tblDate
WHERE [DateOffset]>-12) AS subD LEFT JOIN [SELECT [PV],
[MonthEnd]
FROM Dashboard_PV
WHERE [Initials]=Forms!Stats.cb Initials) AS subH
ON subD.YM = subH.MonthEnd
ORDER BY subD.Month DESC;[/CODE]
Code:
Table Name=[[U]Dashboard_PV[/U]] [I]Field; Type; IndexInfo[/I] Initials; AutoNumber; PK MonthEnd; String PV; Number Username; String
Now I need a query that calculates performance percentages going back 3 months, 6 months, 9 months and 12 months. For example, we are looking at data from 3 months back, the current month the last month and the month before, that is, the 3rd month back is summed up and divided. The basic formula is:
For the current month:
Code:
Dashboard_PV - MEQA/Dashboard_PV * 100 For 3 months back: Sum(last 3 months Dashboard_PV) - Sum(Last 3 months MEQA)/SUM(Last 3 months Dashboard_PV) * 100 = For 6 months back: Sum(last 6 months Dashboard_PV) - Sum(Last 6 months MEQA)/Sum(Last 6 months Dashboard_PV) * 100 = For 9 months back: Sum(last 9 months Dashboard_PV) - Sum(Last 9 months MEQA)/Sum (Last 9 months Dashboard_PV )* 100 = For 12 months back: Sum(last 12 months Dashboard_PV) - Sum(Last 12 months MEQA)/SUM(Last 12 months Dashboard_PV * 100) =
I wrote this out as clearly as possible, Please let me know if you want me to clarify something-
I was researching about EXCEL as a possibility for these calculations. I wanted to know how you felt about this. Could it work? Could it be viable?
Thanks so much
Richard
Comment