Create a template from an analysis and change it with different dataset failed

I have an Analysis with multiple sheets, datasets, visuals, filters, and parameters, and I have created a template based on this analysis. Now I want to change the datasets in the template to have new datasets
but I get this error.

An error occurred: An error occurred (InvalidParameterValueException) when calling the CreateTemplate operation:
Given data sets [arn:aws:quicksight:eu-west-1:1111111:dataset/01158f9e-d6e8-433e-932c-95a161e456f0,
arn:aws:quicksight:eu-west-1:1111111:dataset/066f11ef-8c0c-4137-b49b-636fc3347ad9,
arn:aws:quicksight:eu-west-1:1111111:dataset/208a1f2d-39ea-487e-834c-ca712423e106,
…]
are not part of analysis

The reason for the creation of a template based on analysis is like below:
I have multiple clients and each client has its datasets. I want to have one analysis but create a separate dashboard for each client. So I thought if I created a template based on my analysis and then replaced datasets and then created a dashboard based on this modified template it should work but unfortunately, I got the above error.
How can I fix this?
Is this approach correct?

Hello @Noorali,

Have you tried using asset bundle? You can define the new datasets to be used when importing.

Hope this helps!

Hi @Noorali,
It’s been awhile since we last heard from you, did you have any additional questions regarding your initial post?
If we do not hear back within the next 3 business days, I’ll go ahead and close out this topic.

Thank you!

Hi,
I have the following JSON output when I use describe_analysis_definition. I want to know how I can use this JSON file and which part of this JSON file is useful for the creation of a Template.

Hello @Noorali, I wouldn’t recommend utilizing the describe_analysis_definition function to manage this. Any time you try to update the JSON in a definition like that, it is going to create errors that are difficult to resolve and nearly impossible to understand. Rather, you are going to want to utilize the asset_bundle commands like @andres007 mentioned above.

In the documentation, I would check out the examples section where it utilizes the overrides-parameter feature to update the datasource utilized in the analysis. You will want to make sure your datasets contain the same fields (field names matter here, case sensitive) so that the datasets will map correctly. If the schemas match, this functionality should work.

Otherwise, if you wanted to work from a template like you originally mentioned, then you can use the update-template command. This will allow you to update the datasource/datasets for the analysis. I linked the documentation for the command in CLI, but you can do this programmatically as well with the QuickSight SDK.

Hi @Brett
What I want is like below:
I want a template containing all charts and datasets, filters, parameters,… Then for each client, I want to select which chart and corresponding filters and datasets should be removed from that comprehensive template So I remove them and publish the dashboard based on that modified template.
Is this task possible using describe_analysis_definition?
What is your suggestion?

Hi @Noorali,
That functionality will not be achievable with the describe_analysis_definition. You can create a template from an analysis, import the template and change the dataset attached. But you will not be able to pick and choose which resources in the analysis, only change in the data.

An alternate approach would be to explore RLS if working with multiple clients.

Hi @Noorali,
It’s been awhile since we last heard from you so following back up; did you have any additional questions regarding your initial post?

If we do not hear back within the next 3 business days, I’ll close out this topic.

Thank you!

Hi @Noorali,
Since we haven’t heard back, I’ll go ahead and close out this topic. However, if you have any additional questions, feel free to create a new topic in the community and link this discussion for relevant information if needed.

Thank you!