Dynamic Date Filtering for KPI Widgets – Need Help with Query Table

Dynamic Date Filtering for KPI Widgets – Need Help with Query Table

Hello,
I'm seeking help with setting up dynamic date filtering for my KPI widgets in Zoho Analytics. Below is an overview of my setup and the issues I'm facing:

Why:
I need my KPI widgets to update dynamically based on a date range selected via a dashboard date picker. My goal is to have the entire data chain—from the original source table, through my Query Tables, to the KPI widgets—update automatically when the date range changes.

How:

Original Table Presentation:
    1. My initial data is stored in a wide-format table where each dossier (record) includes separate date columns for different process stages. For example:

      IndexColContactDateMandatDateAccordClientDateSoldeDate
      12024-01-052024-01-092024-01-152024-01-20
      22024-02-032024-02-082024-02-122024-02-20
      ...............


Unpivoted Table ("Unpivoted_CRMKeyed"):

To simplify analysis, I transformed the wide table into a long format using a Query Table, resulting in:

IndexColEtapeDateEtape
1
Contact2024-01-05
1Mandat2024-01-09
1Accord Client2024-01-15
1Solde2024-01-20
2Contact2024-02-03
2Mandat2024-02-08
.........

This unpivoted structure allows me to easily calculate delays between stages and apply a single global date filter on "DateEtape."

Query Tables and KPI Widgets:

First Query Table:
I created a Query Table grouping by IndexCol to calculate delays between stages. For example, to compute the days between "Contact" and "Mandat":

  1. SELECT
  2.     "IndexCol",
  3.     DATEDIFF(
  4.         MAX(CASE WHEN "Etape" = 'Mandat' THEN "DateEtape" END),
  5.         MAX(CASE WHEN "Etape" = 'Contact' THEN "DateEtape" END)
  6.     ) AS "DiffContactMandat",
  7.     -- Additional calculations for other stage delays...
  8. FROM "Unpivoted_CRMKeyed"
  9. WHERE "DateEtape" >= '2024-01-01'
  10.   AND "DateEtape" <= '2024-12-31'
  11. GROUP BY "IndexCol"
This Query Table works perfectly with static dates.

Second Query Table & KPI Widgets:
I then built a second Query Table to aggregate the delay calculations (for example, computing the average delay for each transition) and used these aggregated values as the source for my KPI widgets.

  1. SELECT
  2.     AVG("DiffContactMandat") AS "Moy_ContactMandat",
  3.     AVG("DiffMandatAccord_Client") AS "Moy_MandatAccord_Client",
  4.     AVG("DiffAccord_ClientSolde") AS "Moy_Accord_ClientSolde",
  5.     AVG("DiffContactSolde") AS "Moy_ContactSolde"
  6. FROM "FirstQueryTable"

Sample Result of Second Query Table:

Moy_ContactMandat
Moy_MandatAccord_Client
Moy_Accord_ClientSolde
Moy_ContactSolde
4.8
6.2
7.1
12.3

I then use these aggregated values as the source for my KPI widgets.

Dynamic Date Filtering Issue:
I want to replace the static date values in the Query Tables with dynamic ones controlled by a dashboard date picker (using user variables like ${varDateStart} and ${varDateEnd}). However, when I attempt to do so, I get errors (e.g., "Invalid Date Format" or "Usage of variables in SQL query is not supported"). I've verified that the variables contain strings in "YYYY-MM-DD" format, but the dynamic filtering still fails.

I need guidance or workarounds to implement dynamic date filtering for my KPI widgets in Zoho Analytics. Specifically:

How can I enable a dashboard date picker to update user variables (or otherwise apply dynamic date filters)?
How can I apply these dynamic dates to filter either the original table or the Query Tables, so that the entire KPI chain updates automatically?
Are there any recommended alternative approaches if user variables cannot be used directly in Query Tables?

Any help or suggestions to resolve this issue would be greatly appreciated.

Thanks in advance!

Best regards,

Christophe
    • Sticky Posts

    • Create and save user-specific filter views with Zoho Sheet

      The filters in Zoho Sheet have become even more collaboration-friendly. Previously, whenever you filtered any data, the filtered view will be updated for all the spreadsheet collaborators. This disturbed the data for others working on the same file. With this new update, you can apply data filters without altering the view for other collaborators in the file.   Collaborate with user specific filters   Let us say you are working on a sales report spreadsheet in real time with two remote colleagues. If
    • [Webinar] Why AI Must Stand on the Solid Foundation of Analytics & Business Intelligence

      Are you prepared for the age of AI? Organizations that have a solid foundation in analytics and business intelligence will be in a better position to harness GenAI, agentic apps, and intelligent automation. Join Doug Henschen and Mike Ni, VPs and Principal
    • [UI Update] Mandating New UI for all Zoho Analytics Users

      Dear Users, We’re pleased to share that the new and improved Zoho Analytics 6.0 user interface has already been embraced by many users, delivering a faster, cleaner, and more efficient experience. For the Zoho Analytics users who are still using the old
    • Customer Segmentation using RFM Analysis

      How well do you know your customers? Whether you operate in a B2B or B2C space, chances are that 80% of your business comes from just 20% of your customers (Pareto's Principle). According to a study by Forbes, acquiring new customers costs five times
    • What's New in Zoho Analytics - March 2025

      Hello Users, We're back with the latest set of enhancements and improvements aimed at improving your analytics experience. Common Query Table Expression (CTE) support in Query Tables We’ve added support for Common Table Expressions (CTE) in Query Tables,
    • Recent Topics

    • Automation #6 - Prevent Re-opening of Closed Tickets

      This is a monthly series where we pick some common use cases that have been either discussed or most asked about in our community and explain how they can be achieved using one of the automation capabilities in Zoho Desk. Typically when a customer submits
    • Zoho Payroll's USA and KSA editions are available in Zoho One!

      Greetings! We’re excited to share that Zoho Payroll, currently available only in India and the UAE, is now introducing the KSA (Kingdom of Saudi Arabia) edition and the USA (United States of America) edition, and these editions are now available in Zoho
    • What is the difference between a template and a snippiet

      Hi there, I am currently working on optimising our service desk and improving the consistency of our responses. I have come across two tools that appear to help do this, templates and snippets. I was wondering what the similarities and differences are
    • Zoho Recruit - Automatic email before expiry date

      Hi, how can we automate email going out to candidate if one of the 3 fields are 30 days or less before expiry? All available workflow triggers are update/create/delete based but I want this to be independent of any activity on candidates profile. Is it
    • Display CRM account field on Zoho Desk Ticket

      I have linked a custom CRM Account field for "Customer Care Lead Advisor" with Zoho Desk Accounts. I know the data has synced correctly as I am using this field for some automations based on this lead advisor field. When viewing a ticket that is linked
    • Is there a way to set up templates for commonly occurring issues on Zoho Desk

      Hi there, We have recently migrated our service desk over to Zoho. I was wondering if there is a way we can set up custom templates for specific requests that we commonly get from our customers. Example: Customer often requests a password reset. There
    • Announcing Early Access to "Zoho CRM for Everyone" — A new and exciting update to Zoho CRM

      We are delighted to announce an Early Access to Zoho CRM for Everyone— a truly democratic approach to managing a CRM, gift-wrapped in an exciting and intuitive user interface. Here, multiple teams across an organization can coordinate among each other
    • Function #35: Close all tasks associated with a lead and create a new task.

      Welcome back everyone! Last week, we learnt how to close all tasks of a deal depending upon the deal stage. This week, let's look at a custom function that lets you close all of the tasks associated with a lead while simultaneously creating a new task, like when you need to halt all progress towards a lead while the lead is not available at the moment but create a reminder task. Business scenario: The success of a company, in one way or another, is determined by the leads it gets. Each lead is just
    • Tables for Europe Datacenter customers?

      It's been over a year now for the launch of Zoho Tables - and still not available für EU DC customers. When will it be available?
    • Exchange Rate Updates

      Hi, It would be great that when you work with multiple currencies, the exchange rate updates automagically every day (as seen on Zoho Books) or at least that when you create/update an opportunity the exchange rate could be manually updated, or maybe both!
    • Feature Request - Approval Processes

      Hi Team, I think it would be really valuable to add the approval process feature like what is currently available in the CRM. The problem with the current approval support is it can't be automated to send the approval to set people based on the values of fields within the tickets. Is this something that could be considered for the roadmap? Thanks, Harry
    • Zoho CRM and Books Integration

      Evening, I have started the integration with FSM from CRM and having difficulties with the mapping. In CRM we use "Unit Price" as our cost price and mark this up on a subform to create a "Sell Price" this markup can be different on each quote depending
    • Check Validation Rules all fields on Quick Edit on Record Details Page

      I've added validation rules for some fields in a module — let’s say 3 out of 6 fields have rules. On the Edit Page, if any of those fields have an error, I can’t save the form — which is good. But on the Details Page, I can still quick edit other fields
    • zoho crm intergration with zoho campaign

      I  to intergrate zoho CRM with zoho campaigns https://help.zoho.com/portal/en/kb/crm/integrations/zoho/zoho-campaigns/articles/zoho-campaigns-crm-integration#Configuring_the_integration_and_setting_up_sync but in step1, when i click to zoho campaigns,
    • Allow reconciliation for bank acct with no transactions for month

      Is there a way to allow a bank reconciliation to take place when there are no transactions for the month? I am unable to create a reconciliation for the month because there are no transactions to select. I want to be able to attach the bank statement
    • How can I bulk import product images to Zoho crm.

      How can I import product images to Zoho crm within bulk imports. I am using an excel sheet or csv and want to include an image (via URL) for each product. This topic is the closest I have found to a solution but I need further help to implement it: https://help.zoho.com/portal/en/community/topic/import-file-upload-and-image
    • Canvas Flex Box containers should not require a width/height.

      Flexbox containers are often used as organizational concepts, to ease re-flow on mobile etc. - I cannot use % for flexbox W or H - I cannot omit W or H This means that the content cannot dictate, and a Flexbox container cannot be used merely as an organizational
    • Currency fields and decimal places in CRM email templates

      Hi, How do I get more than the standard 2 decimal places showing in a Currency field, on an email template? In the Layout for my Currency field, it is set to 6 decimal places. I want to show up to 6 places in the email template (unrounded). See attached
    • Dial Charts in Analytics using field values for colored ranges

      Hey all! It would be supremely helpful if we could use field values for ranges in Analytics for dial charts. We currently display an analytics report to our sales team showing how close they are to reaching the next tier for commission payouts. We update
    • Zoho Cliq 4.0: Zoho Cliq Android TV application

      Zoho Cliq is a powerful communication and collaboration platform that allows teams to stay connected and get work done from anywhere, at any time. One of the latest additions to its suite of tools is the Zoho Cliq android TV app, designed to make it easier
    • Filter a report for a specific bank and a specific transaction type (interest income)

      I am trying to run a report - any report - on a specific bank account for the interest income. I do not see it as an option. I can see the Bank Account under Account in the Filters, and I can see the Interest Income under Account in the Filters But I
    • Company with ZohoOne, notebook ask to upgrade to collaborate in notecards.

      Hello, we as a company have ZohoOne as our Zoho choice, but Zoho Notebook asks us to upgrade in order to collaborate in notecards, is this correct? Acording to what I've read in Zoho Notebook help, it should be included in ZohoOne, can you please clarify
    • Show Zoho Books Retainer Invoice in Zoho CRM

      Hi Support, How can I get Retainer Invoices created in Zoho Books to show in Zoho CRM? If a sales person needs to collect an upfront deposit, they should be able to see that the retainer invoice has been created and paid. Thanks, Ashley
    • Introducing Assemblies and Kits in Zoho Inventory

      Hello customers, We’re excited to share a major revamp to Zoho Inventory that brings both clarity and flexibility to your inventory management experience! Presenting Assemblies and Kits We’re thrilled to introduce Assemblies and Kits, which replaces the
    • Outgoing blocked again.

      Hi Dear, My outgoing mails are blocked again. I am just using it as normal business emails going in and out. Could you please help fix the problem? I am happy to support where I can do to make it work properly. Thank you very much. Aurora
    • Restrict card movement in Kanban View

      Hello everyone, I’m wondering if there’s a way to prevent users from moving Deal cards in the Kanban view when grouped by Stage. On the Deal details page, I’ve implemented several validations to ensure users cannot change stages until all conditions,
    • Missing "Created_Time" Field in Zoho CRM API Search Results

      Hello, I've noticed that the "Created Time" field is visible in the Zoho Canvas view for my Accounts Module. However, I'm unable to retrieve this field's value via the Zoho CRM API. Specifically, when using the /search endpoint for the Accounts module,
    • How can I switch from inches to centimeters?

      Hey Zoho-Team, I tried to switch to another measuring unit. Inches are not used in Europe, but i couldn't find an option to use metric units. How can I switch the ruler, tabstops, positions of elements and everything else to the metric system? Thank
    • In India is Zoho Free plan restricted to companies with turnover less than Rs. 25,00,000/= ?

      Dear Team, In India is Zoho Free plan restricted to companies with turnover less than Rs. 25,00,000/= ? If not, what are the restrictions. Thank you, Anup
    • Zoho Creator Mobile app no Default Workspace

      When I use the Zoho Creator mobile app I do not get a default workspace. This is occurring for me and another new user. I believe this is an issue with Zoho One / Zoho Creator. I have tried working with support and it's been over a week of no solution
    • Zoho Voice VS in Zoho CRM for logging calls

      I don't understand the differences between logging calls in Zoho Voice VS in Zoho CRM. Why the 2 separate platforms? Seems confusing
    • Assistance Required for Zoho Bulk Import Error

      Hi, I am currently attempting a bulk import in Zoho with a small batch of records to test if the import will be successful. However, despite matching all fields correctly, I continue to encounter the following error: "Not a standard user: Prospect Owner."
    • Is CRM On Premise available

      Hi Zoho team, Can you please let me know that CRM Zoho is available for On Premise as well? Thanks, Devashish
    • How to make Deal field required for "Standard" layout and hidden in "Customer Portal" Layout?

      How to make Deal field required in tge "Standard" layout and hidden in "Customer Portal" Layout?
    • On Duty Requests using API

      Currently we can only do attendance entries using API, we need to make on Duty Requests using API Use Case We are using different on premise devices to track meetings, we want to sync this data with Zoho People Currently we are manually making on duty
    • We're turning five this May, and we need your participation to make this more memorable!

      Dear customers, We can't believe it's going to be five years since we launched Bigin. From our humble beginnings to becoming the go-to CRM for small businesses worldwide, this journey has been incredible, and it's all thanks to YOU— our amazing customers.
    • Support for Transparent, Shadowless Panels in Zoho Creator Pages

      Hi Zoho Creator Team, Hope you're doing well. We would like to request more design flexibility in Zoho Creator, specifically the ability to create panels with no background, border, or shadow. Use Case: In our app, we’re designing a dashboard that uses
    • Automate Zoho Meeting Creation via Blueprint (Leads & Accounts)

      I need help automating Zoho Meeting creation during a blueprint transition in both the Leads and Accounts modules. Requirements: Triggered via blueprint Read meeting start time (DateTime field) and internal participants from CRM Create Zoho Meeting via
    • Bank transaction automation

      I would like to automatically update the "Reference#" field with whatever text is in the "Description" field each time Zoho Books pulls my bank feeds. I've figured out the automation all the way up to the Field Update, where "Reference Number = ...???"
    • Adding Product Photos through Import or In Bulk

      I am about to add about 1000 products in the CRM. I am shocked that there is no way to add product photos through the Import feature. I'll be spending days adding product photos.... Very dissapointing. Anyone know of a work around to add product photos
    • Next Page