6 Replies Latest reply on Jun 12, 2018 5:11 AM by anand mishra

    Dynamic time frame

    shristy sundaram

      I want to add a drop down in my dashboard which will select the time frame for display. I want to toggle between month and quarter.

      Somewhat like below images

        • 2. Re: Dynamic time frame
          shristy sundaram

          The above link didn't help much as I have taken data month wise and applied start date and end date parameters.

          • 3. Re: Dynamic time frame
            Zhouyi Zhang

            Hi, Shristy

             

            Can you provide a sample workbook?

             

            ZZ

            • 4. Re: Dynamic time frame
              Tim Dines

              Create a parameter that has two choices, month and quarter.  Create a calculated field that creates the data points based on the parameter selection, use a Case statement.  Drag this calculated field into the sheet.  When you change the parameter, then the line graph should change.

              • 5. Re: Dynamic time frame
                Mavis Liu

                Hi Shristy,

                 

                Please create the parameter:

                 

                2018-06-12_13h01_55.png

                 

                Then create this calculated field:

                 

                if [Date Period] =1

                then

                str( datename('month',[NEW ORDER DATE])) + ' ' +

                right(str(DATEPART('year',[NEW ORDER DATE])),2)

                else 'Q'+

                str( datename('quarter',[NEW ORDER DATE])) + ' ' +

                right(str(DATEPART('year',[NEW ORDER DATE])),2)

                END

                 

                Then put this in the view instead of your current date field.

                 

                Now sort your new date field by ascending min date:

                 

                2018-06-12_13h03_11.png

                 

                2018-06-12_13h03_50.png

                 

                Attached the workbook for you, please take a look.

                 

                Thanks,

                 

                Mavis

                • 6. Re: Dynamic time frame
                  anand mishra

                  Hi shrishty,

                  First create a parameter (say parameter 4) and selecting data type string and allowable values: all and then type the values there as quarter and month which will be displayed as your parameter values.

                  show ur parameter by option of show parameter control

                  then

                  You can make a calculated field (say calculation1) and use the formula:

                   

                  CASE [Parameter 4] WHEN 'quarter' THEN  DATENAME('quarter',[Order Date])

                  WHEN 'month' THEN DATENAME('month',[Order Date])

                  END

                  and drag the calculation1 in the coloumn and measure in rows (say sales)

                  note: if u have data for many years and you want to select for a specific year(say 2017) then drag the date field in the filter shelve and select the particular option of year u want.

                   

                  now in parameter whenever u select quarter then u get the data quarter wise and when u select month,u get the data monthwise.

                  drag the same sheet on the dashboard and toggle between the options of quarters and months as required.

                   

                  further if u want ur quarters to be shown as q1,q2,q3,q4 (and not as 1,2,3,4 as it appears there) then right click the axis showing quarters there and edit aliases and change 1,2,3,4 to q1,q2,q3,q4 respectively.

                  Please find attached workbook for same