1 2 Previous Next 21 Replies Latest reply on Mar 11, 2014 10:43 PM by Ville Tyrväinen

    Letting user show which metrics to display

    CJ Ragnarsson

      How can I let the user select which measures to display in a worksheet? I may have 20 measures in my worksheet, and I want the user to be able to select which ones to display in a certain sheet among 5 selected ones, using checkboxes. The measures I have may be regular metrics or table calculations.

       

      The way I'd like to think of it is as creating a Calculated Field on top of Measure Names, but this is not possible/allowed as far as I understand.

        • 1. Re: Letting user show which metrics to display
          Joshua Milligan

          CJ,

           

          I agree that this is likely not possible -- especially since you have a mixture of metrics and table calculations.  If you happen to have a packaged workbook (.twbx) file to upload (using mocked-up data if necessary), then it might help members of the community see if there are any other possibilities for your case.

           

          Regards,

          Joshua

          • 2. Re: Letting user show which metrics to display
            CJ Ragnarsson

            So, assuming that these are just measures, is there any way to let the user choose which ones to display? The main problem I'm facing is still that if I use "measure names" directly, it will show all of the measures I have in my worksheet. The problem with table calculations I can get around by just recreating them as Calculated Fields.

             

            And the nature of Measure Names seems to be such that it can not be duplicated so I can add it to context and filter (like you can do with other measure if you don't want to show all items to the user).

            • 3. Re: Re: Letting user show which metrics to display
              Joshua Milligan

              CJ,

               

              You can use a parameter to allow the user to select a measure and a calculated field to dynamically use the value of the measure for the visualization.  I've attached a workbook that demonstrates this.


              Regards,

              Joshua

              1 of 1 people found this helpful
              • 4. Re: Re: Letting user show which metrics to display
                Joshua Milligan

                Just to point out, in light of your original question, that this approach will only allow one selection at a time.

                 

                --Joshua

                • 5. Re: Re: Letting user show which metrics to display
                  Jonathan Drummey

                  There are a couple of other routes that I can think of, though both suffer from the limitation that we can't actually limit a filter selection to 5 or less.

                   

                  One is to use Measure Names as a Quick Filter. To limit the available measures in the list, you can Hide the unwanted measures. However, those hidden measures can't be used in other worksheets for that data source, so to work around that you can create a duplicate data source and hide them in the duplicate. Note that table calculations in this case will need their default compute using set in the Edit Calculation window, otherwise they'd default to Table Down or Across when the filter brings them into the view. I set an example up in the attached.

                   

                  The other is to unpivot your data so that there's a row for each measure, with the measure name and value as a dimension and measure, respectively. Then you can build a "display measure" that uses something like a CASE statement based on the measure name to return the appopriate values, and you can use table calcs in that as necessary (though the addressing & partitioning will be more complicated). Then you could use a filter on a duplicate of the measure name to exclude the values that you don't want to show, and use a regular Quick Filter with "Show Only Relevant Values" selected to only show the list of possible measures.

                   

                  Jonathan

                   

                  PS: If you're in a portal environment with Tableau Server, the bonus third option would be to build your own filter using the Javascript API and wrap the Tableau view in that.

                  • 6. Re: Re: Letting user show which metrics to display
                    Allison Brown

                    Thank you for this! Works beautifully

                    • 7. Re: Letting user show which metrics to display
                      Eric Tobias

                      Life was wonderful, I was singing, and warm blessings from the Universe were headed your way, Jonathan, for your solution to limiting measure names in quick filters. It was perfect and addressed a challenging, if slightly misguided requirement I had.

                       

                      Then I ran into the dreaded, "can't filter a secondary data source" limitation. I created the duplicate of the data source, limited the fields, got the right values in the quick filter, but there are five or six non-parameter-based filters on the original data source that I can't apply to the duplicated data source. I've tried a few things, but cannot find a way to apply the same criteria from the original to the duplicate data source.

                       

                      Have you found any way around this?

                      • 8. Re: Letting user show which metrics to display
                        Jonathan Drummey

                        I'd like to help, and without more information I can't help you. What are the fields that you're getting a "can't filter a secondary data source" error for? Why can't you apply some filters on the primary to the secondary? (And when you're using a duplicated data source, why aren't they filtering both already?) What are the dimensions used in the view, and the dimensions used for data blending? What is the level of granularity in your data sources and in the view?

                         

                        This is why we ask for packaged workbooks and sample data, it's often faster/easier for you to build the sample workbook than try to anticipate all the questions I might have.

                         

                        Jonathan

                        • 9. Re: Letting user show which metrics to display
                          Eric Tobias

                          Thanks for the response, Jonathan. I certainly understand how much easier life is when posters put packaged workbooks up. Done it quite a few times as requestor and requested! However, I can't in this case as it is a client's highly confidential information. I was doing the "blind ask" thinking maybe there was some quick & easy switch or toggle I'd overlooked. Since a packaged workbook is now called for I'll have to mock something up, which will likely take some time.

                           

                          Thanks for the effort, and once I get a moment to breath I'll mock something up and upload.

                          • 10. Re: Re: Letting user show which metrics to display
                            Eric Tobias

                            Jonathan, I finally have enough time on my hands to assemble an example of what I need to accomplish. I'm attaching a workbook that is based off your solution. My main problem is that I can't apply a filter that affects the original data source and the duplicate data source. I want the end-user to be able to select a quick filter on the primary data source, and it automatically applies to the duplicate.

                             

                            See attached workbook. When I click a different area code, it applies to the original data source. I can't see a way to have the selection apply to the duplicate data source as well. I've tried blending using the area code field, applying the quick filter to the duplicate data set, and creating a calculated field that compares area code from the primary to area code of the duplicate. None get the proper results.

                             

                            The ideal result would be for a selection on Dashboard 1 in the top "area code" quick filter to automatically filter the "dup w/hidden measures" view at the bottom. As of now, the only way I can get the top and bottom to show the same data is to manually select the same set of area codes in the bottom quick filter.

                            • 11. Re: Re: Re: Letting user show which metrics to display
                              Matt Lutton

                              http://vizwiz.blogspot.com/2012/06/create-global-filter-in-tableau-across.html

                               

                              Sorry to jump in here.  You can use a parameter in place of the quick filter--but this only allows one selection at a time.  See attached for example. The basic instructions are in the link above--you need one parameter, and a calculation in each data source to evaluate whether the Area Code in that data source matches the Parameter value.  The Parameter allows us to add values from a field, when choosing the "list" option.

                               

                              You could also use action filters to filter across data sources.  There may be other approaches more suitable for your scenario, but this is what I know.

                              • 12. Re: Re: Re: Letting user show which metrics to display
                                Eric Tobias

                                Looks pretty good. I'll check it out in more detail.In the real world dashboard there are about five or six filters that are global and would need to cascade to the duplicate data source. I'll work on implementing this and see if I run into any issues.

                                • 13. Re: Re: Re: Letting user show which metrics to display
                                  Matt Lutton

                                  There is no "only relevant values" option for parameters either, so I'm sure you'll find limitations.  Jonathan may be able to provide more advanced options/considerations for your particular scenario, I just know we can apply Parameters and Filter Actions across data sources. 

                                  • 14. Re: Re: Letting user show which metrics to display
                                    Jonathan Drummey

                                    Hi Eric,

                                     

                                    What I had previously set up was two distinct data sources that happend to be the same data. What it seems like you're looking for is to have two separate data sources (to get the separate lists of Measure Names) but have a common filter. Right now, the only ways to filter across completely separate data sources in Tableau is to use a parameter, Filter Actions,  or some JS API wizardry.

                                     

                                    If you tie the data sources together in any way using a data blend, then you're limited to whatever Measure Names are in the primary data source and the ones you have filtered for from the secondary source.

                                     

                                    Taking a step back here, it looks like you're trying to have a couple of text tables at once. Text tables are good for one thing, and that's to look up exact numbers (like a phone book). Otherwise they are much worse than other visualization types for making comparisons, seeing trends, etc. And honestly Tableau isn't very good at text tables. You might take a look at the comments on this thread Sort Grand Total Amongst Individual Locations? for some ideas on how you might be able to take your users in a different direction that meets their needs and works better with Tableau.

                                     

                                    Jonathan

                                    1 2 Previous Next