Cross reference one parameter with another

Our web application needs to pass a url parameter (an ID number) from another location in the app to the page where our dashboard is embedded. We need to filter the dashboard data based on this parameter, but need to use a different identifier from our dataset in the actual visuals (a name).

is there a way to cross reference the url parameter (or any parameter) with another parameter that is being used in each visual so that it filters the same way it would if the passed parameter and parameter bound to each visual matched?

Hi @jtroxel, in the data preparation phase, you can create a calculated field and later link this field to a parameter during analysis. However, if a calculated field is created during the analysis phase, it cannot currently be linked to a parameter. When setting up your parameter control and selecting “link to a dataset field,” only calculated fields created during the data prep phase appear in the list of available fields to choose from. Note: Calculated fields made in the analysis phase do not appear in this list.

Here are some more resources:

We hope this solution worked for you. Let us know if this is resolved. And if it is, please help the community by marking this answer as a “Solution.” (click the check box under the reply)

thanks @Xclipse this looks like it might be the right path but i am still stuck on how to cross reference the passed parameter with a corresponding value. I am compelled to use some version of javascript’s “this” property, eg:

ifelse(${GrantID} + TRUE, {Grantee}, NULL)

this of course doesnt work as expressed above but looking for a solution with a similar logic to: “for a given GrantID, return its corresponding Grant name”

is this possible?

@Xclipse maybe there’s a simpler way to describe the challenge. I need to look up, and then filter on one value based on another value passed as a URL parameter. Is this possible?

Hi @jtroxel, handling a situation where you need to cross-reference a URL parameter with a different dataset identifier requires a bit of setup but is feasible. This is particularly useful for embedding scenarios where you pass parameters from a web application to control the visuals in QuickSight.

Here’s how you can achieve this:

Step 1: Prepare Your Dataset

First, ensure that your dataset in QuickSight includes both the identifier that you will receive from the URL parameter (let’s call it ID_Number) and the identifier you need to display or use in the visuals (let’s call it Name).

Step 2: Set Up a Dataset with Both Identifiers

Your dataset should have a structure where each ID_Number is associated with a Name. This mapping is crucial because it allows QuickSight to recognize the relationship between the two identifiers.

Step 3: Use URL Parameters in QuickSight

When embedding a QuickSight dashboard, you can pass URL parameters to filter the dashboard. Set up your embedding URL to pass the ID_Number as a URL parameter.

Step 4: Create a Calculated Field for Filtering

In QuickSight, create a calculated field that will serve as a filter based on the URL parameter. This field will act as a bridge between the ID_Number passed in the URL and the Name used in your visuals.

Matched_Name = ifelse({ID_Number} = ${url_parameter}, {Name}, null)

In this calculated field, ${url_parameter} should be the placeholder for the URL parameter you pass. Replace {ID_Number} and {Name} with your actual field names.

Step 5: Apply the Filter to Your Visuals

Use the Matched_Name calculated field as a filter in your visuals. Set the filter to exclude null values. This way, only the records where Matched_Name is not null (i.e., where ID_Number matches the URL parameter) will be displayed.

Step 6: Embed Your Dashboard

When embedding the dashboard into your web application, make sure to pass the ID_Number correctly as a URL parameter. Here’s a basic example of how to structure your embedding URL:

https://your-region.quicksight.aws.amazon.com/sn/embedded/dashboards/12345678-1234-1234-1234-123456789012?ID_Number=specificID

Replace your-region and the dashboard ID with your actual AWS region and dashboard ID, and specificID with the dynamic ID you want to pass from your web application.

Conclusion

This setup allows you to pass a specific identifier through the URL, which filters your dataset indirectly through another identifier. It’s particularly useful for scenarios where the direct identifier used in the dashboard is not suitable or available in the embedding application. Make sure your dataset is properly structured with clear mappings between these identifiers to ensure accurate filtering.

We hope this solution worked for you. Let us know if this is resolved. And if it is, please help the community by marking this answer as a “Solution.” (click the check box under the reply)

1 Like

@Xclipse wow thank you so much for these detailed steps. and yes, the web app scenario you outlined is exactly our use case. however, i am still unable to get it to display the data indicated by the passed parameter. rather than automatically populating the dashboard with the relevant data, it simply displays “No data” in the visuals for all names in the dropdown except the name referenced in the url parameter when it is selected.

for the filter, i normally select “custom filter” and then select a parameter for to filter from. however, i notice that when selecting this, i can no longer specify “exclude nulls”. is there different filter type i should be using for this to work (eg., 'Filter list", “Custom filter list”, etc.)?

1 Like

Hi @jtroxel, thank you for your feedback. It seems the issue might be related to how the filter is set up in QuickSight. Let’s try a different approach with the filter settings to ensure it correctly excludes null values and only shows the data related to the ID passed via the URL parameter.

Step 1: Check Your Calculated Field Ensure your calculated field (Matched_Name) is set up correctly as follows:

Matched_Name = ifelse({ID_Number} = ${url_parameter}, {Name}, null)

This field should correctly return the Name when the ID_Number matches the URL parameter, and null otherwise.

Step 2: Adjust the Filter Setup Instead of using a “Custom filter,” which doesn’t allow you to exclude nulls directly, try setting up your filter as a “Filter list” or “Custom filter list.” Here’s how you can do it:

  1. Create a New Filter using the Matched_Name field.
  2. Select “Filter list” as the filter type if you want users to see and select from a list of available names.
  3. Alternatively, use “Custom filter list” if you want to programmatically control what appears in the list without user input.
  4. Set the filter condition to “is not null” to ensure that null values are excluded. This will prevent the dashboard from showing the “No data” message when the ID_Number from the URL does not match any entry in the dataset.

Step 3: Apply and Test the Filter Apply the new filter setting and test the dashboard by embedding it again with a specific ID_Number in the URL. Check if the dashboard now displays the data for the corresponding Name without showing “No data.”

Example URL:

https://your-region.quicksight.aws.amazon.com/sn/embedded/dashboards/12345678-1234-1234-1234-123456789012?ID_Number=specificID

Replace your-region, the dashboard ID, and specificID with the actual values.

On a side note, check out this QuickSight Embedded Analytics Developer Portal which contains code examples.

We hope this solution worked for you. Let us know if this is resolved. And if it is, please help the community by marking this answer as a “Solution.” (click the check box under the reply)

In case you need further assistance with your problem, please create a sample dashboard with sample dataset showing this specific problem state using Arena and post it here. (Details on using Arena can be found here - QuickSight Arena

2 Likes