2 Replies Latest reply on Jun 26, 2018 2:37 PM by Deepak Rai

    Unable to mix aggregate and non-aggregate calculated field - using two sources

    Kyle Kuvin

      I'll preface this with saying I'm still new to Tableau. So if there is a super obvious solution, I apologize now. I searched other posts in this forum and I'm still not getting the formula to work.

       

      I'm trying to set up an IF statement where I compare the hire date of a record and if an employee record has been updated or not. I have two sources pulling this data. The date field comes from one source and the record update another. Here's the current formula and it produces the aggregate/nonaggregate error:

       

      IF DATEDIFF('day', [Date], DATE(TODAY())) <= 60 AND ATTR([Sheet1 (Source Data2)].[Record Update])="No"

      THEN "Good"

      END

       

      I've tried removing the ATTR, and using FIXED (which I'm probably doing incorrectly) and I'm just stuck.

       

      Thanks in advance!

        • 1. Re: Unable to mix aggregate and non-aggregate calculated field - using two sources
          Jim Dehner

          Hi Kyle

          first welcome to tableau and the forum

           

          that error is generated when one of the fields in a formula is aggregated and others are not

          you blended the data (without seeing the TWBX workbook I can't comment it that was the right thing to do)

          so you are bringing a field from your secondary source to the primary - when you do that the field is aggregated - in this case with ATTR()

          so in your formula [date] needs to be aggregated -- you can use min(), max() or attr() whichever makes sense - since you are comparing it to Today (a number) you should use min()

           

          IF DATEDIFF('day',min( [Date]), DATE(TODAY())) <= 60 AND ATTR([Sheet1 (Source Data2)].[Record Update])="No"

          THEN "Good"

          END

           

           

          Jim

          If this posts assists in resolving the question, please mark it helpful or as the 'correct answer' if it resolves the question. This will help other users find the same answer/resolution.  Thank you.

          1 of 1 people found this helpful
          • 2. Re: Unable to mix aggregate and non-aggregate calculated field - using two sources
            Deepak Rai

            IF DATEDIFF('day', ATTR([Date]), ATTR(TODAY())) <= 60 AND ATTR([Sheet1 (Source Data2)].[Record Update])="No"

            THEN "Good"

            END