3 Replies Latest reply on Nov 12, 2014 2:17 PM by KK Molugu

    Data source filter question

    Tom Bennett

      I have a data source with multiple occurrences of events, but I only ever care about the most recent occurrence of an event.  For example, for a given Client (ClientID), we have multiple survey phone calls (Type=999) on different dates (ActivityDate).  We only care about the most recent.  So I want to do something like: select max(ActivityDate), ClientID from DATASOURCE where (Type=999) group by ClientID.  I'm a Tableau relative newbie and don't know how to filter my data source that way (or if it's really even possible).  Can anyone help?  Thanks so much in advance.

        • 1. Re: Data source filter question
          KK Molugu



          If you already have the data in Tableau workbook, you can achieve what you are looking for and only showing the data that you are looking for;


          - bring your client to rows

          - bring your activity date to row shelf. Make it discrete and select Max operation

          - now put your type on the filter shelf and select 999.


          Check attached workbook 'Show Some' sheet with superstore data as the sample.


          If this is not what you are looking for, please send a sample workbook with some data.



          • 2. Re: Data source filter question

            You can do this even before you bring the data to Tableau:


            Drag your specific table in the 'connect to data' window. Click on extract and then click edit extract, add filters and specify relative dates or whatever dimension you need to filter out. This way Tableau is not loaded with unnecessary data to begin with. Capture.PNG

            • 3. Re: Data source filter question
              KK Molugu



              With the data extract you are only getting what you need and in this situation Tom can get all 999 type records. But, the challenge is to bring the latest record by the activity date by customer.


              To your point, if you want to filter the data before bringing into T, you can use custom SQL and get what you want.


              Welcome to the community