4 Replies Latest reply on Nov 11, 2016 10:33 AM by Sherzodbek Ibragimov

# Mix aggregation error on measures

I could use a little assistance…..

I’m trying to calculate the days between dates excluding weekends.  I’ve figured out the formula but noticed that it included holidays.  We have a file in our database that flags holidays so I created a calculated field that counts the number of holidays in the data range. In trying to subtract the number of holidays from the number of days between dates, I’m getting the aggregation error.

Calculated field = Plan Days:

Holiday Count

COUNT([Wdexcp])

When I try to evaluate these two calculated fields, I get the aggregation error…

Any assistance is appreciated…

• ###### 1. Re: Mix aggregation error on measures

Cedric,

Since you have COUNT function in your calculation, you should also convert other calculation to aggregated level. Have you tried to use ATTR() in front of each calculation above and see what it does. For more info: Resolving "Cannot mix aggregate and non-aggregate arguments" Calculation Error | Tableau Software

I hope it helps.

Sherzod

• ###### 2. Re: Mix aggregation error on measures

As Sherzodbek has mentioned try to agg your Plan day calculated field because you've already agg your Holiday count field. Use agg functions like ATTR(),SUM(). Try this

Let us know If this help.

Mahfooj

• ###### 3. Re: Mix aggregation error on measures

Thanks for leading me down the correct path.  I was able to reach a solution using a variation of your suggestion.

IF sum(DATEDIFF("weekday",[Sess Add Date],[Certify Date])-2*(DATEPART('week', [Certify Date]) -DATEPART('week', [Sess Add Date])))-[Holiday Count]<0 then

sum(DATEDIFF("weekday",[Sess Add Date],[Certify Date])-2*(DATEPART('week', [Certify Date]) -DATEPART('week', [Sess Add Date])))+[Holiday Count] ELSE