2 Replies Latest reply on Mar 21, 2016 5:22 AM by Pratik Rudra

    Time hierarchy

    Pratik Rudra

      Hi ,

       

      My requirement is to create a date hierarchy based on 2 filters

      First filter will show Year,Quarter,Month

      Second filter will show the date based on first filter only

       

      If I select Year in first filter then second filter will show only values like 2016,2015,2014

      If I select Month in first filter then second filter will show only values like 2016 Jan Feb Mar,2015 Jan Feb Mar,2014 Jan Feb Mar

      If I select Quarter in first filter then second filter will show only values like 2016 Q1 Q2 Q3 Q4,2015 Q1 Q2 Q3 Q4,2014 Q1 Q2 Q3 Q4

       

      The second filter design can be flexible.

      If this can be done in JS and and we can integrate it to tableau pls refer.

       

      Thanks,

        • 1. Re: Time hierarchy
          Shinichiro Murakami

          Pratik,

           

          Here you go.

           

          Set Parameter

           

          Create four calculated fields

          [Header_Year]

          str(year([Date]))

           

          [Header_Quarter]

          str(year([Date]))+" Q"+str(datepart('quarter',[Date]))

           

          [Header_Month]

          str(year([Date]))+" "+right(str(100+month([Date])),2)+DATENAME('month',[Date])

           

          [Header_param]

          case[Select_YQM]

          when "Year" then [Header_Year]

          when "Quarter" then [Header_Quarter]

          when "Month" then [Header_Month]

          END

           

           

          Thanks,

          Shin

           

          9.0 attached.

          1 of 1 people found this helpful
          • 2. Re: Time hierarchy
            Pratik Rudra

            Hello Shinichiro,

             

            Thanks a lot for your reply.

            It's working as per the expectation.

             

            I have 2 questions -

            1)

            If I make it to day level then the dropdown list will become huge ,is there any way can we separate in 4 different filters and enable/disable the filter based on first parameter choosing.

            say I will have 4 filters year , month and quarter and days additional to YQM

            when I will select year in YQM then only my year filter will be enabled and rest 3 will be disabled

            When I will select month in YQM then only my year and month filter will be enabled and the rest 2 will be disabled

             

            2)

            Also We are taking dates based on the order date ,say for a particular month there is not order so that month wont appear in my filter.

            Is the any way can I fill those missing dates in the filters ?

             

            Thanks again for your help.