Getting Distinct ID Count based on the date range
- SELECT
- "Opportunities.Entity",
- count(DISTINCT("Opportunities.Id")) AS 'Total Opportunities',
- if(MONTH("Opportunities.Created Time") = Month(Now() - 1), count(DISTINCT("Opportunities.Id")), '0' ),
- count_if(MONTH("Opportunities.Created Time") = Month(Now()) - 1) as 'Opportunities Last Month',
- count_if(("Opportunities.Stage" = 'Deal Won')
- AND ("Opportunities.Deal Type" = 'New Deal')
- AND (MONTH("Opportunities.Closing Date") = Month(Now()) - 1)) As 'Deal Won Last Month',
- ((count_if(("Opportunities.Stage" = 'Deal Won')
- AND (MONTH("Opportunities.Closing Date") = Month(Now()) - 1)
- AND (("Opportunities.Deal Type" = 'New Deal')))) / count_if((Month("Opportunities.Created Time") = (Month(Now()) -1)))) * 100 AS "Conversion Ratio",
- sum_if(((MONTH("Opportunities.Closing Date")) = ((month(now())) -1))
- AND ("Opportunities.Deal Type" = 'New Deal')
- AND ("Opportunities.Stage" = 'Deal Won'), "Opportunities.Actual Booking Amount") AS "Actual Booking Amount",
- avg_if(((MONTH("Opportunities.Closing Date")) = ((month(now())) -1))
- AND ("Opportunities.Deal Type" = 'New Deal'), "Opportunities.Actual Booking Amount") AS "Average Booking Amount",
- sum_if(("Opportunities.Stage" = 'Deal Won')
- AND ("Opportunities.Deal Type" = 'New Deal')
- AND (Month("Payment Collection Info (Clubbed Duplicate OPP ID).Collection Date")) = ((month(now())) -1), "Payment Collection Info (Clubbed Duplicate OPP ID).Collection Amount") AS 'Collection Amount',
- count_if(("Payment Collection Info (Clubbed Duplicate OPP ID).Collection Amount" > 0)
- AND (Month("Payment Collection Info (Clubbed Duplicate OPP ID).Collection Date")) = ((month(now())) -1)
- AND ("Opportunities.Stage" = 'Deal Won')
- AND ("Opportunities.Deal Type" = 'New Deal')) AS "No of orders (collection)",
- sum_if((Month("Opportunities.Closing Date")) = ((month(now())) -1)
- AND ("Opportunities.Stage" = 'Deal Won')
- AND ("Opportunities.Deal Type" = 'New Deal'), "Opportunities.Pending Collection") as 'Pending Collection'
- FROM "Opp+paymentinfo+users"
- GROUP BY "Opportunities.Entity" /* This is a sample SQL SELECT Query */
- /*Use "Control + Space Bar" to see other keywords*/
Query Error: Improper usage of GROUP BY clause.
Please ensure that all non-aggregate columns used in the SELECT clause are also used in GROUP BY clause.
I am trying to count the distinct Opportunities.Id based on the month however I am stuck at this.
if(MONTH("Opportunities.Created Time") = Month(Now() - 1), count(DISTINCT("Opportunities.Id")), '0' ) --- Line 4
Any inputs appreciated.
Sticky Posts
Announcing Zoho Analytics 6.0 Beta!
We are delighted to open up the next major version, Zoho Analytics 6.0 Beta! The new version comes packed with a wide range of functionalities for all persona, namely business users, data analysts, data engineers, and data scientists. Zoho Analytics team
What's New in Zoho Analytics - August 2024
Hello Users! We are back with the latest updates and enhancements made to Zoho Analytics. Keep reading to learn more about them. Connect to the data hosted in the cloud without allow-listing the IP addresses Utilize Zoho Databridge to connect to the data
We are coming to your city! Zoho Analytics Community Meetup
Hello, business leaders and data enthusiasts! We are delighted to announce that registrations are now open for the ZUG meetups, and we can't wait for you to be a part of them. Our in-house analytics experts are geared up to lead discussions on constructing
Zoho Analytics: 2021 Look Back
As we start a new year in 2022, here's some of our top moments from 2021. Zoho Analytics in 2021
[Customer Talk] PREMO Group's Analyst Interview at Zoho Day 2022
Premo Group, a 50 year old Spanish Manufacturing Company, has been our long-standing customer with #ZohoAnalytics. They've been using our platform for their end-to-end, unified business analytics solution. Hear more from Claudio Cabeza, Director at PREMO