Skip to main content

Hi All,

 

I have a scenario in Tableau to implement a Quarter slider.

 

The report itself has to initially filter on the MAX(Order Date) as in quarters. So the max quarter is pulled in the report.

 

Now, I will need to implement a slider that will help me toggle to previous 6 quarters. On report opening the initial view should be of latest quarter but user needs to be provided with an option to use a "Quarter" slider to toggle to previous quarters.

 

Please refer to the attached workbook and advise on how to implement this solution to the sheet or on a dashboard.

 

Thanks

 

Simon Runc

16 answers
  1. Sep 19, 2018, 2:05 PM

    So here you go...

     

    I first adapted our Index Calculation, and renamed it "Quarters Back"

    [Quarters Back]

    DATEDIFF('quarter',[Order Date], {MAX([Order Date])})

     

    I also set up a parameter with the values 0-5 on a slider

     

    We can then use the parameter and the above field to tag the 2 quarters we need

    [Quarter Selected and Comp]

    IF [Quarters Back] = [Select Quarters (0 = Current, -1 Previous...etc.)]

    THEN 'Current'

    ELSEIF [Period] = 2 THEN

       IF [Quarters Back] = [Select Quarters (0 = Current, -1 Previous...etc.)]+1 THEN 'Comp' END

    ELSEIF [Period] = 1 THEN

        IF [Quarters Back] = [Select Quarters (0 = Current, -1 Previous...etc.)]+4 THEN 'Comp' END

    END

     

    and then we can then bring this onto the canvas (filtering out nulls) and then we use the "hide" option to hide the "comp" value (we don't want to see it, but need it to perform the YoY/QoQ calculation, which is what hide does)

     

    And that's it really. The 'how it works' shows what the calcs and parameters are doing and the 'parameter solution' sheet shows how the final table looks. This already has the actual quarter in the Row, but you could have another sheet which (depending on the parameter selection) just shows the selected quarter (it's just the "current" value from our [Quarter Selected and Comp] field)

     

    Hope that helps

0/9000