8 Replies Latest reply on Mar 17, 2016 7:17 PM by Shivang Desai

# Cannot mix aggregate and non-aggergate comparsions or results in IF Expression

Hi All,

I am stuck in this question and so majority of my work is stalled.

I have written the logic below but getting error in calculation. Is there any way to solve this?

[Metric to View] is a parameter which is working for other things except "Expired Members"

[NOTE: There are 2 important things to note:

1) THERE IS A SEPERATE METRIC CALLED "Expired Members"

2) THERE IS A CALCULATED FIELD CALLED "Expired members"

]

My Expired members is a calculated field as shown below:

Thanks,

Shivang Desai

• ###### 1. Re: Cannot mix aggregate and non-aggergate comparsions or results in IF Expression

Shivang!

Wrap the last part with an ATTR()

ELSEIF ATTR([Expired Member]) = 'Expired' then .....

All parts of the IF/THEN should either be an aggregate or not, you can't mix the 2.

Hope that helps!

Pooja.

• ###### 2. Re: Cannot mix aggregate and non-aggergate comparsions or results in IF Expression

Hi Pooja,

I tried this but nothing shows up in the graph!

Regards,

Shivang Desai

• ###### 3. Re: Cannot mix aggregate and non-aggergate comparsions or results in IF Expression

Hey Shivang!

Hard to understand the underlying cause of that without seeing or being able to interact with the data. Are you able to attach the workbook?

Pooja.

• ###### 4. Re: Cannot mix aggregate and non-aggergate comparsions or results in IF Expression

Hi Pooja,

I would like to but due to my organization rules and policies, its difficult to upload the workbook..

Kind Regards,

Shivang Desai

• ###### 5. Re: Cannot mix aggregate and non-aggergate comparsions or results in IF Expression

Hi Pooja,

I used the following and it is working

IF [Metric to View] = 'Members Acquired' then [Total Members]

ELSEIF [Metric to View] = 'Acquisition Rate' then [AQRate (copy 2)]

ELSEIF [Metric to View] = 'Live Member Group' then [Total Members]

ELSEIF [Metric to View] = 'Loyalty Sales' then [Nett]

ELSEIF [Metric to View] = 'Member Frequency' then [FRE_TRND_AllMembers (copy)]

ELSEIF [Metric to View] = 'Member Ticket Average' then [TA_Members (copy)]

ELSEIF [Metric to View] = 'Member Points' then [Points]

ELSEIF [Metric to View] = 'Expired Members' AND [Expired members] = "Expired" then [Total Members]

end

Thanks a lot for the help!

Highly appreciated.

Kind Regards,

Shivang Desai

• ###### 6. Re: Cannot mix aggregate and non-aggergate comparsions or results in IF Expression

I just changed the calculated fields like TA_Mmebers, AQRate  which were aggregated to non-aggregated ones. and applied the logic in the previous message.

• ###### 7. Re: Cannot mix aggregate and non-aggergate comparsions or results in IF Expression

Awesome! Glad you got it to work.

• ###### 8. Re: Cannot mix aggregate and non-aggergate comparsions or results in IF Expression

I will make sure to attach a sample workbook next time so that it becomes easy to communicate!

Regards,

Shivang