Dynamic parameters based on data field

Hello,
I want to create control parameter in which possible values should be dynamically changing based on the other parameter in which I choose time range type (week/month/quarter).
This should work that for given time range it shows me only adequate options to choose:

  • for week 1-52
  • for month 1-12
  • for quarter 1-4

Right now I tried to set it up by creating parameter (paramTest) in dataset which is mapped to parameter used in “Sampling time” control and create calculated field (controlTest) in data set which is using this parameter.
“”" controlTest calculated field “”“”
ifelse(
${paramTest} = ‘week’,
dateDiff(truncDate(“WK”, truncDate(‘YYYY’, TimeStamp)), TimeStamp, ‘WK’)+1,
ifelse(
${paramTest} = ‘month’,
extract(“MM”,TimeStamp),
extract(“Q”,TimeStamp)
)
)
“”"

The main issue I experiencing is that the values in dropdown menu are not changing when I change the “Sampling time” parameter. The values in the “controlTest” are changing correctly when checking in the table in analysis, but in drop down menu the values are always the same and taken from first part of the ifelse statement (in case it is weeks I am getting 1-53, in case of change and quarter would be first in ifelse statement

1 Like

Settings for the parameter I want dynamic values:

Hi,

this doc may help you.

a Hint.
You can create new fields for week, month and quarter, user them into filter.
regards,
Naveed Ali

Hi Naveed,

thanks for the link, but still I cannot find solution for my issue.
I am also not sure what you mean that I can create week/month/quarter fields and then using them as filter. How that would work? Would it be 3 different controls or how would they change between them?

I’ll try to rephrase and simplify what I want to achieve:
Based on the option on the left control (“Sampling time”) I want to change the possible values available in the right control’s drop down menu (“Time range”), if week is chosen it should be from 1 to 52, if month from 1 to 12 and quarter from 1 to 4.
image

Hello @krzymat, my apologies for the delayed response. Due to the fact that your controlTest variable is being created as a calculated field, there is no way for the Control with the dropdown of values to reference the change. You built out the field correctly to implement on the visual but managing the controls are a lot trickier.

In order to get the dynamic change you want in your control dropdown, it would require reworking the dataset that links to the controls. You would essentially need that Sampling Time field as a column, where rows are split by either Week, Month, Quarter. Then, depending on the value selected in the dropdown, you could use cascading filters in QuickSight to ensure only the correct Time Range values would display. Other than that, there is not a work-around to manage that dynamic type of dropdown in the QuickSight console.

I hope this helps! I will mark this response as the solution for now, but if you need more information or still have a question please let me know.