Restricting Drop Down Filter Values

by adam.hu@keboola.com (& marcus.wong)

This guide is for restricting the values that you would like to see in the Drop Down filters. This is used in two scenarios:

1) When you have lots of values in an attribute, but for a certain dashboard you only want to show only some of the attributes because others are not relevant
2) When you have mandatory user filters (MUF) set up, drop down filters that are downstream of where the MUF is set on, do not "listen" to the MUF, so it shows all values to all customers (even for those values that don't belong to them).


Step 1:

Start this process by creating a count metric in such a way that when you count the attribute that you want to filter on, it returns >0, and every other attribute would return null.

Example (For Scenario 1): SELECT COUNT ((EmployeeID(Employees) , ID(Orders)) WHERE EmployeeID(Employees) = 123

This metric will return null for everything except where EmployeeID(Employees) = 123, so now you will only see Orders in the dropdown filter that belong to EmployeeID = 123.


Example (For Scenario 2): SELECT COUNT ((EmployeeID(Employees))

This metric will filter the drop down filter for only EmployeeID's that are not null.  So if your dropdown filter is on any attribute of the Employee table, it will only show values with existing EmployeeID's (which are filtered by an MUF upstream from the LDM).  



Step 2: Go to the Manage tab in GoodData, and under metrics, find the metric you created in step one. If you copy the address bar from the right hand edge to the left, up to /gdc, you will end up with something like:
/gdc/md/k506f8l5z9kgqznds5n00v8nacppvdab/obj/12350


Project ID

Object ID

Function


Step 3:

[EDITED 2016-03-31] Get your Dashboard definition via GoodData API #4powerUser



Step 4:

Edit your Dashboard definition: Find the section that says “filterItemContent” with the “label” that corresponds to your filter name. Add the “useAvailable:” line to it (in bold):


       filterItemContent:

         id: fr-yui_3_7_1_1_1367854294694_29693

         label: Cost Center

         multiple: 1

         obj: /gdc/md/pe7uqwfe9mt7vcyvrgseioy4i3ixw72v/obj/1164

         useAvailable:

          metrics:

           - /gdc/md/k506f8l5z9kgqznds5n00v8nacppvdab/obj/12203

         type: list


The “- /gdc” portion comes from Step 2 which is URL with the object number of the metric we created.


Now you have to update Dashboard definition via GoodData API #4powerUser



**Note**
- Often is the case, is that the filter appears in gray pages more than once (in step 4, the "label" appears more than once). If this happens to you, a good way (so far that we have found out), is to replicate step 4 for all of the times it appears. The reason it shows multiple times is that each time you add the filter to the dashboard, it will be added to the gray pages (for ex. you add the filter, then you delete it, then you add it again).
Comments