1 Reply Latest reply on Jan 22, 2019 11:49 AM by Michael Hesser

    Dynamically display the measures based on filter value in tableau

    Dilip Divakaran

      I had a requirement where i have to display measures based on a filter created on Dimension value. For eg


      Dimension Filter Value Dropdown  --> Value1, Value2, Value3
      Measures --> Measure1, Measure11, Measure2 Measure21, Measure22, Measure3


      When I select


      Case 1 : 
      Filter -> Value1
      Measure To display -> Measure1, Measure11
      Case2 :
      Filter -> Value2
      Measure To display -> Measure2, Measure21, Measure22
      Filter -> Value3
      Measure To display -> Measure3


      I am new to tableau development and last few days i started using this . I googled few and found one resource in the below link



      But in the above link they shown based on filter value they display only one measures not multiple measures. I need to display multiple measures based on filter value.

      As Explained i followed the process but don't know how to include multiple measures in the below code in Calculate field


      CASE [Filter Parameter]
      WHEN “Value1” THEN Measure1, Measure11
      WHEN “Value2” THEN Measure2, Measure21, Measure22
      WHEN “Value3” THEN Measure3


      Hope it is explained well, please let me know .


        • 1. Re: Dynamically display the measures based on filter value in tableau
          Michael Hesser

          Hi Dilip;

          Some of this depends on how you want to display your information-- if you want it displayed merely as text, or as measures that can be summed, sorted, and so on.


          A quick solution could be treating your measures like text and combining them together:


          Sort Value 1



          There can be all kinds of problems with this solution, though: you lose the ability to manipulate measures as numbers, plus there are sorting restraints.


          Another option you could pursue is GROUPS.

          Convert copies of your measures into dimensions, then use the Combine Fields option to generate groups. (Remember, though, that when creating groups, the elements must be selected in the order you want them to appear in the group). Groups can be very useful, and you can refer to them directly in your CASE statement.


          A third option is creating three levels of filters:


          Filter Level 1

          Case [Filter Parameter]

          When [Value1] then [Measure 1]

          When [Value2] then [Measure 2]

          When [Value3] then [Measure 3]


          Filter Level 2

          When [Value1] then [Measure 11]

          When [Value2] then [Measure 21]


          Filter Level 3

          When [Value2] then [Measure 22]



          Drop all three "filter levels" onto your rows or columns as desired. Each field will be populated by the appropriate measure, give a nice columnar view.

          One downside of this option is it may leave blank columns when the user has selected only a single value to display.


          I hope these suggestions give you some insight to potential solutions. Keep Tableau-ing!