6 Replies Latest reply on Oct 8, 2018 7:27 AM by Jonathan Drummey

# If statement (can't mic aggregate and non aggregate comparison

Hi, I am attaching a workbook where I have two types of purchases (car and house). i am trying to create an if function where i like to sum the amount paid by a constant number. so if my year is 2017 I need to sum the amount and divide by 100 otherwise if my year is 2018 i want to sum amount and divide by 200. the function is not working. any help is appreciated.

• ###### 1. Re: If statement (can't mic aggregate and non aggregate comparison

IF attr(year([Year]))=2017

then SUM([Amount])/100 ELSE SUM([Amount])/200 end

Ritesh

1 of 1 people found this helpful
• ###### 2. Re: If statement (can't mic aggregate and non aggregate comparison

Hello Tony,

You can try below logic:

IF ATTR(YEAR([Year]))=2017 then SUM([Amount])/100 ELSE SUM([Amount])/200 END

If this post helped you to solve your query , the please mark it as CORRECT and HELPFUL.

1 of 1 people found this helpful

• ###### 4. Re: If statement (can't mic aggregate and non aggregate comparison

this great. what about if Year is a string value and can't change it to date. how do I approach this calculation?

• ###### 5. Re: If statement (can't mic aggregate and non aggregate comparison

In that case you can just remove "Year"  function from the logic.

IF ATTR(([Year]))='2017' then SUM([Amount])/100 ELSE SUM([Amount])/200 END