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.


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:


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:



"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

      Zoho Developer Community

                                Zoho Desk Resources

                                • Desk Community Learning Series

                                • Digest

                                • Functions

                                • Meetups

                                • Kbase

                                • Resources

                                • Glossary

                                • Desk Marketplace

                                • MVP Corner

                                • Word of the Day

                                    Zoho Marketing Automation

                                            Manage your brands on social media

                                                  Zoho TeamInbox Resources

                                                    Zoho DataPrep Resources

                                                      Zoho CRM Plus Resources

                                                        Zoho Books Resources

                                                          Zoho Subscriptions Resources

                                                            Zoho Projects Resources

                                                              Zoho Sprints Resources

                                                                Qntrl Resources

                                                                  Zoho Creator Resources

                                                                    Zoho WorkDrive Resources

                                                                      Zoho Campaigns Resources

                                                                        Zoho CRM Resources

                                                                        • CRM Community Learning Series

                                                                          CRM Community Learning Series

                                                                        • Tips


                                                                        • Functions


                                                                        • Meetups


                                                                        • Kbase


                                                                        • Resources


                                                                        • Digest


                                                                        • CRM Marketplace

                                                                          CRM Marketplace

                                                                        • MVP Corner

                                                                          MVP Corner

                                                                            Design. Discuss. Deliver.

                                                                            Create visually engaging stories with Zoho Show.

                                                                            Get Started Now