2 Replies Latest reply on Jan 17, 2019 5:33 AM by Gaytri k

    Apply filter to only one dataset at Data Source Level

    Gaytri k

      Hi Team,

       

      i have two Sql Tables connected to my tableau file with a left join. TableA and TableB.

       

      I would like to apply filter only for the TableB at Datasource Level to fetch the records matches a criteria.

       

      Kindly help me with the options, as now the filter that i have added is applying to both the tables.

       

      Regards

        • 1. Re: Apply filter to only one dataset at Data Source Level
          Michael Gillespie

          You'll have to use Prep (or another external ETL-like tool) or some other mechanism (custom SQL?) in Tableau itself to do this.

           

          A Data Source filter, by definition, applies to the entire Data Source.  if you want to control each individual component of a join within a data source, you'll have to find some other way to do it.

          • 2. Re: Apply filter to only one dataset at Data Source Level
            Gaytri k

            Thanks Michael,

             

            Initially i had a where condition in the SQL query itself to filter the data. But now, my project is expanding the scope and need to eliminate the this filter in SQL query. 

             

            I'm also trying to have a filter created at the worksheet level. and have the LOD : Fixed expression handle the calculation but somehow its not working too.

             

            My LOD calculation is as below :

            { EXCLUDE [Ag (group)]:SUM({FIXED  DATEPART('month', [Date]),DATEPART('week', [Date]),[Company],[Office],[Region],[Country]:COUNTD([emp ID])})}

             

            in the above Calculation the  "[Ag (group)]" is in the TableB and other fields are from TableA.

            When i apply filter in [Ag (group)] field, its affecting the Countd(emp ID) though i have given this field in the EXCLUDE expression.

             

            Any idea, what might be wrong or any other approach to exclude Ag (group) from the calculation?