Hi,
I'm having a very hard time to figure this ridle out and maybe there is no solution, or I'm just going in the wrong direction, however here it is:
I have to calculate the number of deals that come in every day, for that week, month, and year. Than some deals are rejected and I have to do the same thing. The query below shows what I did. So far it works...
However I would need to calculate the true percentage (%) of the rejected deals to the Imported deals in all 4 respects (daily, weekly, monthly and yearly.) showing the value with 2 decimals %-age as the next row in this union querry. Anything I tried so far is a total disaster.
The Table is Customers
The Fields are ImpDate (import date)
PkgID (the 1st 3 character tells me the room I got the deal from)
RejReason (this field containes the preset reject reasons)
Here is my initial querry:
SELECT 1 AS Sort, "Imported Deals" AS Details, Sum(IIf(Format([Customers]![ImpDate],"dd")=Format([Enter Date],"dd"),1,0)) AS Daily, Sum(IIf(Format([Customers]![ImpDate],"ww")=Format([Enter Date],"ww"),1,0)) AS Weekly, Sum(IIf(Format([Customers]![ImpDate],"mmyy")=Format([Enter Date],"mmyy"),1,0)) AS Monthly, Sum(IIf(Format([Customers]![ImpDate],"yyyy")=Format([Enter Date],"yyyy"),1,0)) AS Yearly
FROM Customers
WHERE (((Left([Customers]![PkgID],3)) Like "*ST1*"))
GROUP BY 1;
UNION
SELECT 2 AS Sort, "Rejected Deals" AS Details, Sum(IIf(Format([Customers]![ImpDate],"dd")=Format([Enter Date],"dd"),1,0)) AS Daily, Sum(IIf(Format([Customers]![ImpDate],"ww")=Format([Enter Date],"ww"),1,0)) AS Weekly, Sum(IIf(Format([Customers]![ImpDate],"mmyy")=Format([Enter Date],"mmyy"),1,0)) AS Monthly, Sum(IIf(Format([Customers]![ImpDate],"yyyy")=Format([Enter Date],"yyyy"),1,0)) AS Yearly
FROM Customers
WHERE (((Left([Customers]![PkgID],3)) Like "*ST1*") AND ((Customers.RejReason) Is Not Null))
GROUP BY 2;
Please be patient with me, I'm very new to this.
Thanks.
I'm having a very hard time to figure this ridle out and maybe there is no solution, or I'm just going in the wrong direction, however here it is:
I have to calculate the number of deals that come in every day, for that week, month, and year. Than some deals are rejected and I have to do the same thing. The query below shows what I did. So far it works...
However I would need to calculate the true percentage (%) of the rejected deals to the Imported deals in all 4 respects (daily, weekly, monthly and yearly.) showing the value with 2 decimals %-age as the next row in this union querry. Anything I tried so far is a total disaster.
The Table is Customers
The Fields are ImpDate (import date)
PkgID (the 1st 3 character tells me the room I got the deal from)
RejReason (this field containes the preset reject reasons)
Here is my initial querry:
SELECT 1 AS Sort, "Imported Deals" AS Details, Sum(IIf(Format([Customers]![ImpDate],"dd")=Format([Enter Date],"dd"),1,0)) AS Daily, Sum(IIf(Format([Customers]![ImpDate],"ww")=Format([Enter Date],"ww"),1,0)) AS Weekly, Sum(IIf(Format([Customers]![ImpDate],"mmyy")=Format([Enter Date],"mmyy"),1,0)) AS Monthly, Sum(IIf(Format([Customers]![ImpDate],"yyyy")=Format([Enter Date],"yyyy"),1,0)) AS Yearly
FROM Customers
WHERE (((Left([Customers]![PkgID],3)) Like "*ST1*"))
GROUP BY 1;
UNION
SELECT 2 AS Sort, "Rejected Deals" AS Details, Sum(IIf(Format([Customers]![ImpDate],"dd")=Format([Enter Date],"dd"),1,0)) AS Daily, Sum(IIf(Format([Customers]![ImpDate],"ww")=Format([Enter Date],"ww"),1,0)) AS Weekly, Sum(IIf(Format([Customers]![ImpDate],"mmyy")=Format([Enter Date],"mmyy"),1,0)) AS Monthly, Sum(IIf(Format([Customers]![ImpDate],"yyyy")=Format([Enter Date],"yyyy"),1,0)) AS Yearly
FROM Customers
WHERE (((Left([Customers]![PkgID],3)) Like "*ST1*") AND ((Customers.RejReason) Is Not Null))
GROUP BY 2;
Please be patient with me, I'm very new to this.
Thanks.