Count of Distinct IDs when they appear multiple times within a selected time period

Count of Distinct IDs when they appear multiple times within a selected time period

I have a transactions table which includes the columns: date, customer_id and order_id. I want to be able to count the distinct customer_ids within a date range when those customer_ids appear across multiple rows (because they have multiple orders within that date range. 

It's easy to get a distinct count of customer_ids for the date range, but I'm struggling with how to essentially filter down to a distinct list of those ids who appear on 2 or more rows. 

I was trying to use CASE WHEN .... THEN but I can't say, count_distinct( CASE WHEN count(customer_id)>0 THEN customer_id END) 

Any help would be gratefully received. Hopefully I'm overthinking this!

    Access your files securely from anywhere

        All-in-one knowledge management and training platform for your employees and customers.







                              Zoho Developer Community




                                                    • Desk Community Learning Series


                                                    • Digest


                                                    • Functions


                                                    • Meetups


                                                    • Kbase


                                                    • Resources


                                                    • Glossary


                                                    • Desk Marketplace


                                                    • MVP Corner


                                                    • Word of the Day


                                                    • Ask the Experts



                                                              • Sticky Posts

                                                              • What's New in Zoho Analytics - January 2026

                                                                Hello Users! We are starting the year with a strong lineup of updates, marking the beginning of many improvements planned to enhance your analytics experience. Explore the latest improvements built to boost performance, simplify analysis, and help you
                                                              • What's New in Zoho Analytics - November 2025

                                                                We're thrilled to announce a significant update focused on expanding your data connectivity, enhancing visualization capabilities, and delivering a more powerful, intuitive, and performant analytics experience. Here’s a look at what’s new. Explore What's
                                                              • What's New in Zoho Analytics - October 2025

                                                                Hello Users! We're are back with a fresh set of updates and enhancements to make data analysis faster and more insightful. Take a quick look at what’s new and see how these updates can power up your reports and dashboards. Explore What's New! Extreme
                                                              • What’s New in Zoho Analytics – September 2025

                                                                Hello Users!! In this month’s update, we’re raising the bar across multiple touchpoints, from how you bring in data, plan and track projects to how you design and brand your dashboards. We’ve added the all-new Gantt chart for project visualization, expanded
                                                              • Announcing Agentic AI - Ask Zia!

                                                                We are delighted to roll out the new agentic AI capabilities in Ask Zia, where every stage of the BI workflow is assisted by AI. With a human-in-the-loop approach, Ask Zia ensures that you’re in command of the decision, while AI handles the complexity.


                                                              Manage your brands on social media



                                                                    Zoho TeamInbox Resources



                                                                        Zoho CRM Plus Resources

                                                                          Zoho Books Resources


                                                                            Zoho Subscriptions Resources

                                                                              Zoho Projects Resources


                                                                                Zoho Sprints Resources


                                                                                  Qntrl Resources


                                                                                    Zoho Creator Resources



                                                                                        Zoho CRM Resources

                                                                                        • CRM Community Learning Series

                                                                                          CRM Community Learning Series


                                                                                        • Kaizen

                                                                                          Kaizen

                                                                                        • Functions

                                                                                          Functions

                                                                                        • Meetups

                                                                                          Meetups

                                                                                        • Kbase

                                                                                          Kbase

                                                                                        • Resources

                                                                                          Resources

                                                                                        • Digest

                                                                                          Digest

                                                                                        • CRM Marketplace

                                                                                          CRM Marketplace

                                                                                        • MVP Corner

                                                                                          MVP Corner









                                                                                            Design. Discuss. Deliver.

                                                                                            Create visually engaging stories with Zoho Show.

                                                                                            Get Started Now


                                                                                              Zoho Show Resources

                                                                                                Zoho Writer

                                                                                                Get Started. Write Away!

                                                                                                Writer is a powerful online word processor, designed for collaborative work.

                                                                                                  Zoho CRM コンテンツ




                                                                                                    Nederlandse Hulpbronnen


                                                                                                        ご検討中の方




                                                                                                                • Recent Topics

                                                                                                                • Full Context of Zoho CRM Records for Zia in Zoho Desk for efficient AI Usage

                                                                                                                  Hello everyone, I have a question regarding the use of Zia in Zoho Desk in combination with CRM data. Is it possible to automatically feed the complete context of a CRM record into Zia, so that it can generate automated and highly accurate responses for
                                                                                                                • Knowledge base printing

                                                                                                                  I saw a posting about printing the knowledge base as I was looking for the answer, but we would like the ability to print out the entire knowledge base with a click, keeping the same organization format.   Bonus would include an index of keywords and
                                                                                                                • Search not working!

                                                                                                                  I have items in my notebook tagged but when I search for a tag nothing comes up! Any fix for this?
                                                                                                                • Zoho Books | Product updates | January 2026

                                                                                                                  Hello users, We’ve rolled out new features and enhancements in Zoho Books. From e-filing Form 1099 directly with the IRS to corporation tax support, explore the updates designed to enhance your bookkeeping experience. E-File Form 1099 Directly With the
                                                                                                                • Updates for Zoho Campaigns: Merge tag, footer, and autoresponder migration

                                                                                                                  Hello everyone, We'd like to inform you of some upcoming changes with regard to Zoho Campaigns. We understand that change can be difficult, but we're dedicated to ensuring a smooth transition while keeping you all informed and engaged throughout the process.
                                                                                                                • File Upload field not showing in workflow

                                                                                                                  Hi, I have added a field on Zoho CRM. I want to use it in a workflow where that particular field is updated based on another field, however it is not showing up in the field list to select it in the workflow. Why is this please?
                                                                                                                • Drag 'n' Drop Fields to a Sub-Form and "Move Field To" Option

                                                                                                                  Hi, I would like to be able to move fields from the Main Page to a Sub-Form or from a Sub-Form to either the Main Page or another Sub-Form. Today if you change the design you have to delete and recreate every field, not just move them. Would be nice to
                                                                                                                • How do i integrate google analytics to Zoho Campaigns?

                                                                                                                  Looking to track Zoho Traffic from email Current topic is outdated
                                                                                                                • How do teams manage meeting follow-ups across Zoho tools?

                                                                                                                  We’re using Zoho tools for collaboration and tracking, but managing meeting notes, action items, and follow-ups across teams is still challenging. Curious how others are handling this within Zoho workflows. Are there best practices or integrations that
                                                                                                                • Adding a Deal to and Existing Contact

                                                                                                                  I want to easily add a Deal to an existing Contact. If I click on New Deal on the Contact page this currently this is what happens: All of the mandatory field (and other field) information exists within the Contact. Is there a simple way for it to automatically
                                                                                                                • Zoho Sprint Backlog View, filter by item status

                                                                                                                  Hello, In Zoho Sprints, it would be great to be able filter out specific items in the Backlog based on their status. We would like to track items that were Removed from our backlog without seeing them constantly in the Backlog view, as this view should
                                                                                                                • Customize Colors used on graphs and charts according to users desire.

                                                                                                                  It would be great if we could customize the graph's colors as we see fit. I hate that yellow is always the default color!
                                                                                                                • Let us view and export the full price books data from CRM

                                                                                                                  I quote out of CRM, some of my clients have specialised pricing for specific products - therefore we use Price Books to manage these special prices. I can only see the breakdown of the products listed in the price book and the specialised pricing for
                                                                                                                • Mejoras urgentes para ZOHO MEETING

                                                                                                                  Tengo unos meses usando Zoho Meeting. En general, es buena, pero hay cosas vitales que no logra cumplir con mínima calidad. 1) Calidad de audio y video: urge mejoras. Audio con retraso, imagen borrosa, mal recorte de silueta con fondos virtuales. Además,
                                                                                                                • Multiple header in the quote table???

                                                                                                                  Hello, Is it possible in Zoho CRM to add multiple headers or sections within the Quote product table, so that when the quote is printed it shows separate sections (for example “Products” and “Services”)? To clarify, I’m asking because: This does not appear
                                                                                                                • Saving sent email campaign as PDF

                                                                                                                  I'm looking to add all campaigns sent to an archive folder in sharepoint. Is there anyway to accomplish this in Zoho Flow ? I'm falling at the first hurdle ... can I automatically save a sent campaign as a PDF to a folder location ?
                                                                                                                • Exporting All Custom Functions in ZohoCRM

                                                                                                                  Hello, All I've been looking for a way to keep about 30 functions that I have written in Zoho CRM updated in my own repository to use elsewhere in other instances. A github integration would be great, but a way to export all custom functions or any way
                                                                                                                • How can Data Enrichment be automatically triggered when a new Lead is created in Zoho CRM?

                                                                                                                  Hi, I have a pipeline where a Lead is created automatically through the Zoho API and I've been trying to look for a way to automatically apply Data Enrichment on this created lead. 1) I did not find any way to do this through the Zoho API; it seems like
                                                                                                                • Conditional Layouts On Multi Select Field

                                                                                                                  How we can use Conditional Layouts On Multi Select Field field? Please help.
                                                                                                                • Make CAMPAIGNS email look as simple as possible

                                                                                                                  Hi there I'm trying to make my Campaigns email look as much like a normal email as possible. I'm a bit stuck with the "justification" of the email email block. Can I LEFT JUSTIFY the "whole email" to make it look "normal"? (Please see screenshot attached)
                                                                                                                • Appreciation to Qntrl Support Team

                                                                                                                  We are writing this topic to appreciate the outstanding level of support from Qntrl Team. We have been using Qntrl since 2022 after shifting from another similar platform. Since we joined Qntrl, the team has shown a high level of professionalism, support,
                                                                                                                • How can I hide "My Requests" and "Marketplace" icon from the side menu

                                                                                                                  Hello everybody, We recently started using the new Zoho CRM for Everyone. How can I hide "My Requests" and "Marketplace" from the side menu? We don't use these features at the moment, and I couldn't find a way to disable or remove them. Best regards,
                                                                                                                • Whatsapp Integration on Zoho Campaign

                                                                                                                  Team: Can the messages from Zoho Campaign delivered through Whatsapp... now customers no longer are active on email, but the entire campaign module is email based.... when will it be available on whatsapp.... are there any thirdparty providers who can
                                                                                                                • Quotes Approval

                                                                                                                  Hey all, Could you please help in the following: When creating quotes, how to configure it in a way, that its approval would work according to the quoted items description, not according to quote information. In my case, the quote should be sent to approval
                                                                                                                • Mandatory Field - but only at conversion

                                                                                                                  Hello! We use Zoho CRM and there are times where the "Lead Created Date & Time" field isn't populated into a "Contractor" (Account is the default phrase i believe). Most of my lead tracking is based on reading the Lead Created field above, so it's important
                                                                                                                • Different Task Layouts for Subtasks

                                                                                                                  I was wondering how it would be possible for a subtask to have a different task layout to the parent task.
                                                                                                                • Enable Free External Collaboration on Notecards in Zoho Notebook

                                                                                                                  Hi Zoho Notebook Team, I would like to suggest a feature enhancement regarding external collaboration in Zoho Notebook. Currently, we can share notes with external users, and they are able to view the content without any issue. However, when these external
                                                                                                                • Using data fields in Zoho Show presentations to extract key numbers from Zia insights based on a report created

                                                                                                                  Is it possible to use data fields in Zoho Show presentations along with Zoho Analytics to extract key numbers from Zia insights based on a report created? For example, using this text below: (note that the numbers in bold would be from Zia Insights) Revenue
                                                                                                                • Free webinar: AI-powered agreement management with Zoho Sign

                                                                                                                  Hi there! Does preparing an agreement feel like more work than actually signing it? You're definitely not alone. Between drafting the document, managing revisions, securing internal approvals, and rereading clauses to make sure everything still reflects
                                                                                                                • WhatsApp Channels in Zoho Campaigns

                                                                                                                  Now that Meta has opened WhatsApp Channels globally, will you add it to Zoho Campaigns? It's another top channel for marketing communications as email and SMS. Thanks.
                                                                                                                • CRM For Everyone - Bring Back Settings Tile View

                                                                                                                  I've been using CRM for Everyone since it was in early access and I just can't stand the single list settings menu down the left-hand side. It takes so much longer to find the setting I need. Please give users the option to make the old sytle tile view
                                                                                                                • Lets have Dynamics 365 integration with Zohobooks

                                                                                                                  Lets have Dynamics 365 integration with Zohobooks
                                                                                                                • Add notes in spreadsheet view

                                                                                                                  It would be great if we could Add/edit notes in the spreadsheet view of contacts/leads. This would enable my sales teams to greatly increase their number of calls. Also viewing the most recent note in the Contact module would also be helpful.
                                                                                                                • Boost your Zoho Desk's performance by archiving tickets!

                                                                                                                  The longer your help desk operations are, the more likely it is to accumulate tickets that are no longer relevant. For example, ticket records from a year ago are typically less relevant than currently open tickets. Such old tickets may eventually lead
                                                                                                                • Opening balances - Accounts Receivable and Payable

                                                                                                                  Our accounting year starts on 1st August 2013 and I have a Trial Balance as at that date, including Accounts Receivableand Accounts Payable balances, broken down by each customer and supplier. Q1 - do I show my opening balance date as 31st July 2013 or
                                                                                                                • Announcing Kiosk 1.1 - Customize screen titles, configure new fields & actions, use values from your Kiosk to update fields, and more.

                                                                                                                  Hello all We are back again with more enhancements to Kiosk. So what's new? Enhancements made to the Components Add titles for your Kiosk screens and adjust its width to suit your viewing preferences. Three new fields can be added to your screen: Percentage,
                                                                                                                • Limited System because of Limited Number of Fields for Car Dealership

                                                                                                                  Dear Zoho Support, we want to have all the information about a car inside of a car record. We want to have Zoho CRM as our single source of truth for our data, but the limited number of fields are not allowing that. The data consist of: technical data
                                                                                                                • Cancel Subscription

                                                                                                                  Hi , Im want to cancel my account but without success please help me to do it
                                                                                                                • Making an email campaign into a Template

                                                                                                                  I used a Zoho Campaign Template to create an email. Now I want to use this email and make it a new template, but this seems to be not possible. Am I missing something?
                                                                                                                • Direct Access and Better Search for Zoho Quartz Recordings

                                                                                                                  Hi Zoho Team, We would like to request a few enhancements to improve how Zoho Quartz recordings are accessed and managed after being submitted to Zoho Support. Current Limitation: After submitting a Quartz recording, the related Zoho Support ticket displays
                                                                                                                • Next Page