3 Replies Latest reply on Jan 21, 2019 11:24 AM by Shinichiro Murakami

    Case When in Tableau

    Ravindra Zinjad

      Hi,

       

      I am stuck with below scenario where I need to calculate new field based on certain case when/If else statements.

      I have a data like below where I need to apply certain combinations on category and Sub Category column so that I can group data.

       

      CategorySub CategoryAmount
      0050
      1060
      2070
      3080
      4090
      01100
      11200
      21300
      31400
      41500
      02600
      12700
      22800
      32900
      421000
      031100
      131200
      231300
      331400
      431500
      041600
      141700
      241800
      341900
      442000

       

      Output I am looking

       

      Category NewAmount
      >=1 Product17600
      >=2 Product12600
      Product = 13860
      Product = 24270

       

      Logic for above field Category New is

       

      >=1 ProductLogic is Category >=1 and Sub Category >=1
      >=2 ProductLogic is Category >=2 and Sub Category >= 2
      Product 1Logic is Category  = 1
      Product 2Logic is Category  = 2

      I have also attached excel file for reference.

       

      Thank you for all inputs and help.