Hi everyone,
I’m working on an Amazon QuickSight dashboard and have a specific use case I’d like help with.
I have a SQL-based dataset using a custom query like this:
SELECT * FROM customers WHERE createdDate > {selectedDate}
What I want is:
- Add a Date Picker control to the dashboard
- Let users select a date
- Then pass this selected date into the SQL query dynamically
- So the dashboard only shows customers created after the selected date
Is this kind of parameter-to-SQL binding supported in QuickSight?
I know parameters can be used in filters, but I want the parameter to affect the actual SQL query, not just do post-filtering.
Any suggestions, workarounds, or documentation would be really appreciated.
Thanks in advance!
Hi @Archie1 ,
this should be the solution you’re looking for:
- Create a dataset, connect it to you SQL database.
- Now create a custom query as you need it, but you have to create the parameter in this way
- Now you can write your query in this way
SELECT * FROM customers WHERE createdDate > <<$selectedDate}>>
- Publish the dataset
Now we move to the analysis:
- if you go to the Parameters tab, you should see an Unmapped parameter
- click on it > Map Parameter > Create new Parameter
- Follow the wizard to the new param with a name you want and the mapping should already been selected
- Once filled the values, you should see a view like this (see below). Select Create a new control…, and that should do the trick!
Now you have a control and, by changing it, you’ll go directly to modify your query.
Just remember that, in this way, every time you enter the dashboard, change the param etc, you will go and do a query to your original source database.
Just evaluate if this is the attended behaviour, or if it’s more convenient to upload the data in SPICE memory, and then just filter on the analysis/dashboard side.
Best regards,
Andrea
3 Likes
Hi @andrepgn ,
Thank you for your quick reply! I will try this out and get back to let you know whether the solution works.
BR,
Archie
Hi @andrepgn
Just wanted to say thanks — your solution worked like a charm! Really appreciate your effort.
BR,
Archie
2 Likes
Thank you @Archie1!
I’ll close this topic now, don’t esitate to contact us for any other need 
See you soon!
1 Like