Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
funwithqueries
Contributor II
Contributor II

Assign default value to variable input dropdown

Hi,

I have built a dashboard that uses a variable as time dimension in visualizations. The variable $(day_date_var) is defined as date(day_date). The user can select if he wants to see data aggregated on a daily, weekly or monthly basis by selecting either option from a dropdown (via variable input extension). 

The variable values within the dropdown are defined as the following:
Daily: date(day_date)
Weekly: WeekEnd(day_date)
Monthly: Month(day_date)

Now, when the dashboard is opened, the default option in the dropdown is always "Daily". How can I change this to "Weekly" being the default option?

Labels (4)
1 Solution

Accepted Solutions
shivanisapkale
Partner - Creator
Partner - Creator

Hello,

Create a variable and pass WeekEnd(day_date) as a value for that variable and set that variable in your drop down extension.

View solution in original post

7 Replies
miskinmaz
Creator III
Creator III

Instead of defining the day_date_var as date(day_date), define the variable with weekend (today()) or likewise.

funwithqueries
Contributor II
Contributor II
Author

Thanks for your feedback. Defining the variable as WeekEnd(day_date) works in that sense that the visualizations get rendered aggregated on a weekly basis, so that's cool 🙂 But the dropdown menu that I use to give the user the chance to change the aggregation level still shows "Daily" instead of "Weekly", thus misleading the user 😞

funwithqueries
Contributor II
Contributor II
Author

Sadly, I wasn't able to find a solution yet. Does someone have another idea?

shivanisapkale
Partner - Creator
Partner - Creator

Hello,

Create a variable and pass WeekEnd(day_date) as a value for that variable and set that variable in your drop down extension.

miskinmaz
Creator III
Creator III

Can you explain for the dropdown is created and why the selection is pointing to the Daily.

shivanisapkale
Partner - Creator
Partner - Creator

What is the default value for the variable which you have pulled for drop-down in variable input button

funwithqueries
Contributor II
Contributor II
Author

After some testing the way that you suggested works! I initialize the variable now as WeekEnd(day_date) and that did the trick. I don't know why I saw the weird behavior before but now the dropdown shows the correct value 'Weekly' as well.

Thank you!