4 Replies Latest reply on May 8, 2018 3:14 AM by Matt Townend

# Tableau Beginner - Need help with Aggregated and Non Aggregated calculation error

Hi everyone,

I have been using Tableau for just a couple of weeks and I have been told the community is a great place for help useful tips and information.

I have a question, how do I fix the attached?  It says I cannot mix an aggregated and non – aggregated comparison, which I get I cannot do.

However, I cannot created a solution. What I want to do is a distinct count the Custom Dimension 1 (which is a Dimension) if the sessions (measure = no. of sessions in a month) is greater than the Avg Session User Toggle (Float parameter I created (1 – 25).

I have attached the error message below.

Any help would be great. Thanks. Matt

• ###### 1. Re: Tableau Beginner - Need help with Aggregated and Non Aggregated calculation error

Hi Matt

welcome to tableau and the forum

any time you get that error it just means that one of the variables you have in you calculation is aggregated and others are not

In your case   countd is an aggregation but your dimension [sessions] has not been aggregated - you can use a number of aggregating functions - Attr(), Min(), Max()

what ever makes sense in your formula     attr([sessions] .....

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.

• ###### 2. Re: Tableau Beginner - Need help with Aggregated and Non Aggregated calculation error

This is the most common error you'll see in Tableau; even advanced users get it.

Tableau can do calculations at two levels: either on each individual row, or by grouping up rows. But it can't do both at the same time.

In your example, referring to [Sessions] is telling it to do the comparison on each individual row (non-aggregated).

But COUNTD([Custom Dimensión 1] is telling Tableau to look across all the rows and count them (aggregated).

Based on your explaination, the first line should probably is

IF COUNT([Sessions]) > [Avg Session User Toggle]

This will resolve the error, because both parts of the expression will be aggregated.

• ###### 3. Re: Tableau Beginner - Need help with Aggregated and Non Aggregated calculation error

Hi Jim,

Thank you very much for your response and helping improve my knowledge. Your information has helped me correct my aggregated and non aggregated issue.

Cheers,

Matt

• ###### 4. Re: Tableau Beginner - Need help with Aggregated and Non Aggregated calculation error

Hi Branden,

Thank you very much for your response and helping improve my knowledge. Your information has helped me correct my aggregated and non aggregated issue.

Cheers,

Matt