How to add dynamic parameter in custom sql query dataset?

I am trying to create a dashboard/visual analysis, which can be viewed by any company subscribed to my application. Each company will have own set of data and it is loaded in S3. I created a dataset with custom sql query option to S3 via athena. Example query
select * from table where companyid = '123'.

The results of the dataset are used to build my dashboard. This all works well and I want to parameterize the company id field, so I can build dashboards dynamically for any company and each one will be able to see data only related to the company.

I am able to add parameter in dashboard/analysis, but I am not able to find a way to pass this parameter to my custom sql query dataset, so the query can be dynamic based on the parameter.

Any help would be appreciated.

I think my understanding about dataset was not clear earlier. I should not have added where filter in custom sql query and found that dataset is about getting all related data across the database and then add filters based on parameters in the analysis/visual.

Now I have remove companyid where clause from my custom sql query and added a parameter in analysis and then created filter based on the parameter. All works well now!

1 Like