Hello everyone,
I have the table 'Transactions' containing all the transactions in an year. The columns of the table are:
Transaction_date
Type
Value
Payer_Id
Status
What I would like to do is a query to group up all the transactions by month, then count the transactions corresponding to each month, Sum up their values and count the tansaction dates (as number of days per monh) for each month.
The problem is that there are numerous transactions with the same date and I need to "Distinct Count" them.
The code I came up with is below, but it gives me an error when saving the query:
The problem is that I get the following error message when I try to save the query:
Syntax error (missing operator) in query expression:
'Format([Transactions.Transaction_date],"mm-yyyy") INNER JOIN TCounts.MonthYear'
Please help!
Thank you very much!
I have the table 'Transactions' containing all the transactions in an year. The columns of the table are:
Transaction_date
Type
Value
Payer_Id
Status
What I would like to do is a query to group up all the transactions by month, then count the transactions corresponding to each month, Sum up their values and count the tansaction dates (as number of days per monh) for each month.
The problem is that there are numerous transactions with the same date and I need to "Distinct Count" them.
The code I came up with is below, but it gives me an error when saving the query:
Code:
SELECT Format([Transaction_date],"MM-YYYY") AS Month
, Count(Transactions.Type) AS [Number of transactions]
, Sum(Transactions.Value) AS [Value]
, TCounts.TCount
FROM Transacions INNER JOIN
(SELECT Count(Transaction_Date) as TCount, MonthYear
FROM (
SELECT DISTINCT (Transaction_Date)
, Format([Transaction_Date],"mm-yyyy") as MonthYear
FROM Transactions
WHERE (Transactions.Status) = "Complete" and (Transactions.Payer_ID) <> ""
GROUP BY MonthYear
)
) as TCounts
ON Format([Transaction_date],"MM-YYYY") INNER JOIN TCounts.MonthYear
WHERE (Transactions.Status) = "Complete" and (Transactions.Payer_ID) <> ""
GROUP BY Format([Transaction_date],"MM-YYYY"), TCounts.TCount;
The problem is that I get the following error message when I try to save the query:
Syntax error (missing operator) in query expression:
'Format([Transactions.Transaction_date],"mm-yyyy") INNER JOIN TCounts.MonthYear'
Please help!
Thank you very much!