5 Replies Latest reply on Dec 14, 2018 4:27 AM by Gudo van Roest

    Default filter to last record - able to change filter later

    Gudo van Roest

      Dear all,

       

      I have a user who wants the sheets in his dashboard filtered to the last week when opening  the dashboard. He also wants to be able to filter to different weeks when the dashboard is open. The snag that I have is that I am not able to use the standard date fields of Tableau. This is because we need to use European week numbers and Tableau uses American by default. Using this formula (INT((Datepart('dayofyear', (dateadd('day',INT(datediff('day', #1900-1-01#, [Actual Goods Movement Date])/7)*7 + 3,#1900-1-01#))) + 6)/7) ) I am able to convert to the correct week. Because this is a numeric field, instead of a date field, I lose the option to check the 'default filter latest date field' box in the filter options.

       

      Does anyone know a workaround where I can default to the last (european) weeknumber, but still have the option to select other weeknumbers later?

        • 1. Re: Default filter to last record - able to change filter later
          Yuriy Fal

          Hi Gudo,

           

          Though there is the 'iso-week' value

          of the DATEPART() function in Tableau 2018.2+,

          the Filter to the latest date... option would give an error:

          1.gif

           

          Please find the attached with the above.

          Pity it couldn't help either.

           

          Yours,

          Yuri

          1 of 1 people found this helpful
          • 2. Re: Default filter to last record - able to change filter later
            Paul Wachtler

            Hi Yuri,

             

            I'm not sure why it's causing an issue, but for some reason the "Show Filter" option is not letting you use the latest date option inside the filter.  Instead of clicking "Show Filter", hold control (or command on a Mac), click on your isoweek field, and then drag it over to the filter field.  This will copy your field into the filter.  Now if you select "Filter to latest date value....." it will work.

             

            Best,

            Paul

            1 of 1 people found this helpful
            • 3. Re: Default filter to last record - able to change filter later
              Yuriy Fal

              Hi Paul,

               

              Thank you for the suggestion.

               

              Dragging the ISOWEEK Pill to the Filters shelf,

              Tableau would ask for the Date part (again),

              and there would be no 'iso-week' option --

              just an ordinary Week numbers,

              so one would have a WEEK Pill

              on Filters at the end.

               

              Yours,

              Yuri

              • 4. Re: Default filter to last record - able to change filter later
                Gudo van Roest

                Actually you did help me out a lot. I did not know of the option to use 'iso-' in datepart functions. With your answer and the answer of Paul I was able to create the filter to last week using iso weeks.

                 

                Thanks!

                 

                --EDIT: Unfortunately, the solution Paul mentioned will revert the field back to the standard datepart 'week'. So though the 'iso-' part was already a big part, it seem like tableau left a bug in where you cannot use the same filter options as with the regular 'week' datepart.

                • 5. Re: Default filter to last record - able to change filter later
                  Gudo van Roest

                  I had submitted this as a bug to tableau. Apparently this is a known bug and should be fixed with release 2019.1 (end of jan 2019). In the meantime they did present a workaround:

                   

                  - Create a pill in the rows or columns with DATETRUNC('iso-week', [Date field]) (it must be continuous)

                  - Right click the pill and select show filter

                  - In the filter panel set the ISO week to discrete.

                       - Now the checkbox is available and the week is still set to ISO

                   

                   

                  Drawback of this workaround is that  the date will show as first day of week (eg 01-01-2018 0:00:00). In the shelves this can be fixed by changing the datetrunc in the pill to datepart, in the filterpanel I have not found a way to change this yet.