Filter Default value using user attribute

Hi everyone,

I am struggling to find a way to set the Default Value of a Dashboard Filter equal to the user attribute.

This is the case:

I have a dashboard with a filter named “Country”. Each user has a user_attribute called “Country”.

What I would like to have is to have a default value for the filter “Country” equal to the contry of the user that is entering the dashboard.

Do you know if there is a wat to do it?

I tried many things, but there seems not to be a way to do it.

Thanks for your help

3bd5b6f2-3202-438d-9bf9-3e82590c2e15.png
1 2 311
2 REPLIES 2

Bumping this because I am trying to do a similar thing.

This is an old post so I hope you found an answer. I hate seeing unanswered questions when they show up in my searches so I'm posting some possible solutions. I'm assuming from your question that this is not about access and anyone from any country can see the dashboard and you want the dashboard to display the most relevant information based on the user's country. 

First, the easiest option is to set the Filter Control to Advanced and select `matches a user attribute` and select the correct attribute. This will always filter the dashboard for the user attribute.

rallaking_3-1713370359750.png

The upside is this is an easy solution that works as expected with little effort. The downside of this option is that if this filter is frequently changed it generally appears complicated to users. To alter this filter it is several steps : change from `matches a user attribute` to `is`, delete the previous attribute value, then filter for the new values. I lost many people's attention in demos trying to explain how to change the filter. They loved having it filter based on their most frequent use case but hated trying to make any changes.

As a way to make it easy for the users, I created a unique "homepage" dashboard for each department and roles (managers, non-managers, assistants, etc.) which is a dashboard made up entirely of Markdown tiles with links to the active dashboards with the filter values added including the user attributes. Each department and role has their home page set in user attributes. The active dashboards have "regular" filters (buttons, tag list, checkboxes...whatever is appropriate) and going to the dashboard directly will not apply any filters unless I've added default values. It's much easier to have a single homepage with the links filtering correctly for all the different perspectives and I've included training to Favorite the homepage and not the individual dashboards. 

You can get the correct URL from the dashboard if you go into edit mode on the dashboard and edit the filter to `matches a user attribute` and then `Get link` in edit mode to get the URL with the filter values.

rallaking_1-1713369971758.png

That URL is used in the Markdown tile to create the link with the default value. Once you have the pattern it is easy enough to edit yourself. Note that I use "Region" as the user attribute for the Province filter, your link would most likely contain `Country=%7B%7B%20_user_attributes%5B%27country%27%5D%20%7D%7D`

 

rallaking_5-1713371684567.png

When the user clicks on the link, they see the dashboard filtered by their user attribute, and the filter appears "normal" so they can click a button, checkbox, etc. to make any filter changes. The homepage dashboard has also been very useful as I also include links to help documentation, Looker videos, buttons to report issues, book training, etc. 

There may be better solutions to setting defaults by user without changing access but I haven't seen them. I tried applying filters in the views and models but couldn't find anything to let me apply a parameter to the filter besides the access filter. Liquid parameters seem to only apply to sql_always_where or view filters which both limit access.

Top Labels in this Space
Top Solution Authors