Zoho reports query table problem

Zoho reports query table problem

Hi,

I wanted to ask you a question regarding one query that I am trying to build so I can make a report out of it.
I had 2 requirements: 
1. Get the potentials that have reached the red zone, and the red zone is a percentage of probability for that potential.
2. Get the potentials that have reached the red zone and ended up being won. The red zone will also be chosen in the report slider.

For the first one I solved the problem by using this query :
  1. SELECT
  2.  potential."POTENTIALID" AS "Potential Id",
  3.  potential."Potential Owner" AS "Potential Owner",
  4.  potential."Potential Name" AS "Potential Name",
  5.  potentialHistory."Modified Time" AS "modified",
  6.  groupedtt."MaxProbability"
  7. FROM  "Potentials" potential INNER JOIN "Potentials Stage History" potentialHistory ON potential."POTENTIALID"  = potentialHistory."POTENTIALID"  INNER JOIN( SELECT
  8.  "Potentials Stage History"."POTENTIALID" AS "PotentialID",
  9.  MAX("Potentials Stage History"."Probability (%)") AS "MaxProbability"
  10. FROM  "Potentials Stage History" 
  11. GROUP BY  "Potentials Stage History"."POTENTIALID" 
  12. ) groupedtt ON potentialHistory."Probability (%)"  = groupedtt."MaxProbability".
  13. AND potentialHistory."POTENTIALID"  = groupedtt."PotentialID"  

And reporting on max probability on the reports.

Now for the second one I a trying to add to that query these following lines: 
 
  1.      WHERE EXISTS 
  2.      (
  3.      SELECT p2."POTENTIALID" FROM "Potentials Stage History" p2 WHERE potentialHistory."POTENTIALID" = p2."POTENTIALID" AND p2."Stage"='Closed Won'
  4.      )
But I am getting this error : " Unknown table or alias 'potentialHistory' used in select query."

Any help would be greatly appreciated.

Best regards,
Edison Rama

      • 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