Creating a query table which counts the number of separate stage 1 and stage 2 payments per month.

Creating a query table which counts the number of separate stage 1 and stage 2 payments per month.

Hi,

I am trying to create a query table which counts the number of separate stage 1 and stage 2 payments from the same module received in the same month. The trouble I’m having is that if I try to calculate these value in a single table Zoho treats them as dependent variables and I don’t get the correct result.

Therefore, I have created two query tables which count the number of stage 1 and stage 2 payments separately, groups them together by month and year and orders them by year and month. Eg. this is the code for the stage 1 table:

SELECT

month("S1 invoice received") as 'Month',

month_name("S1 invoice received") AS 'Month Name',

year("S1 invoice received") as 'Year',

concat(month_name("S1 invoice received"), '-', year("S1 invoice received")) as 'Payment Date',

count("Casework Name") as 'S1 Payments'

FROM  "Casework (Zoho CRM)"

GROUP BY month("S1 invoice received"),

month_name("S1 invoice received"),

year("S1 invoice received"),

 concat(month_name("S1 invoice received"), '-', year("S1 invoice received"))

ORDER BY year("S1 invoice received"),

month("S1 invoice received")

 

I have then created separate query table where I join the stage 1 payment table and stage 2 tables together:

 

SELECT

"S1 payments received"."Year" as 'Year',

"S1 payments received"."Month" as 'Month',

"S1 payments received"."Payment Date" as 'Date',

"S1 payments received"."S1 Payments" as 'S1 Payments',

"S2 payments received"."S2 Payments" as 'S2 Payments'

FROM  "S1 payments received"

JOIN "S2 payments received" ON "S1 payments received"."Payment Date"  = "S2 payments received"."Payment Date" 

ORDER BY "S1 payments received"."Year",

"S1 payments received"."Month"

 

When I click ‘execute query’ the results look promising; however when I click ‘view mode’ the table appears in a different order.

Ultimately what I’m trying to do is create a staked bar chat using the joined table.

Any ideas?

Thanks, Scott