2 Replies Latest reply on May 29, 2014 9:57 AM by Mani Kanigicharla

    cannot use STARTSWITH function with blended data sources

    Mani Kanigicharla

      Hello,

       

      I am trying to use STARTSWITH([Field1],[Source2].[Field2]) function with blended data sources.

      Where [Field1] is from Primary data sources and [Field2] is from secondary data source, both are strings.

       

      When I am adding [Field2] from secondary data source in STARTSWITH(), Tableau is automatically adding ATTR() function.

      STARTSWITH([Field1],ATTR([Source2].[Field2]))

       

      error - cannot mix aggregate and non-aggregate arguments to function.

       

      I also tried removing ATTR()

      STARTSWITH([Field1],[Source2].[Field2])

       

      error - All fields must be aggregate or constant when using table calculation functions or fields from multiple data sources.

       

      Both fields are non-aggregate and constant values, the error message doesn't make any sense.

      I want to use STARTWITH() function to display  the data in my dashboard using values from [Field2] as filter.

      How can I achieve this?

       

      Thanks,

      Mani

        • 1. Re: cannot use STARTSWITH function with blended data sources
          Patrick A Van Der Hyde

          Hello Mani,

           

          Datablending requires aggregate calculations to be utilized since we are always aggregating at the level of the data linking the two data sources.  The calculation will not error if ATTR() (or another aggregate function such as MIN(), MAX() or AVG() is used with [Field1] however it is important to be mindful of the linking fields used between the data sources and how these fields are used in the view. While this is possible, I am guessing it will not provide the desired results.

           

          Instead, what about creating a calculation in each data source such as Left([Field1],3) and Left(Field2],3) and datablending with these two new fields as linking fields?  The downside is Field2 and Field1 would need to have matching data fields for a set number of characters (such as 3 in this example). 

           

          Patrick

          • 2. Re: cannot use STARTSWITH function with blended data sources
            Mani Kanigicharla

            Hello Patrick,

             

            Yes that is the downside, I don't have a fixed set of characters to match.

            Any other ideas?

             

            Thanks,

            Mani