2 Replies Latest reply on Jan 28, 2014 3:37 PM by Kevin Denman

    Why is my nested case statement showing all null values?

    Kevin Denman

      Hi Tableau community -

       

      I am trying to nest one case statement within another. Based on the Tactic and Week, different parameters will be used in the calculated field.

       

      Has anyone done this before successfully? It says the calculation is Valid.

       

      CASE [Tactic]

          WHEN 'TV' THEN

              CASE [Week]

                  WHEN 'WK1' THEN [Sales_TV_Wk1]*[Norm_TV]*[Multiplier]

                  WHEN 'WK2' THEN [Sales_TV_Wk2]*[Norm_TV]*[Multiplier]

                  WHEN 'WK3' THEN [Sales_TV_Wk3]*[Norm_TV]*[Multiplier]

                  WHEN 'WK4' THEN [Sales_TV_Wk4]*[Norm_TV]*[Multiplier]

                  WHEN 'WK5' THEN [Sales_TV_Wk5]*[Norm_TV]*[Multiplier]

              END

       

      WHEN 'Radio' THEN

              CASE [Week]

                  WHEN 'WK1' THEN [Sales_Radio_Wk1]*[Norm_Radio]*[Multiplier]

                  WHEN 'WK2' THEN [Sales_Radio_Wk2]*[Norm_Radio]*[Multiplier]

                  WHEN 'WK3' THEN [Sales_Radio_Wk3]*[Norm_Radio]*[Multiplier]

                  WHEN 'WK4' THEN [Sales_Radio_Wk4]*[Norm_Radio]*[Multiplier]

                  WHEN 'WK5' THEN [Sales_Radio_Wk5]*[Norm_Radio]*[Multiplier]

              END

       

      END