# Mix aggregate and non-aggregate argument in function

Hi together,

my goal is it to report the last week sales in average. Therefore I used the attached function below. How can I solve the error, any advise?

• ###### 1. Re: Mix aggregate and non-aggregate argument in function

good morning the problem is with {Last week ) it needs to be aggregated with min(),max() attr() what ever will work in your calcualtion

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: Mix aggregate and non-aggregate argument in function

thanks Jim,

my Last Week Calculations looks like this. How should I change it with min(), max(), or attr() ?

• ###### 3. Re: Mix aggregate and non-aggregate argument in function

pick one and see what the results are - half the fun of learning process is seeing how changes in the formula affect the results

Jim

• ###### 4. Re: Mix aggregate and non-aggregate argument in function

thx Jim... unfortunately I'm a total beginner and honestly dont' know how to test it - sorry. Hope you can help me out

• ###### 5. Re: Mix aggregate and non-aggregate argument in function

just use Min()

• ###### 6. Re: Mix aggregate and non-aggregate argument in function

honestly I don't know in which of the attached functions and how I should implement the Min() to resolve the issue if mixing aggregate and non-aggregate arguments.

• ###### 7. Re: Mix aggregate and non-aggregate argument in function

I tried this

• ###### 8. Re: Mix aggregate and non-aggregate argument in function

Hi,

You may try this,

LOOKUP(WINDOW_SUM(IIF(ATTR([Last Week]),AVG([Count Total]),NULL)),0)

Let us know if this help.

Mahfooj

• ###### 9. Re: Mix aggregate and non-aggregate argument in function

Hello Djef,

you need put Min(), Max() or ATTR() before [Last Week] in your calculated field that you put in the post.

Cheers.

• ###### 10. Re: Mix aggregate and non-aggregate argument in function

Hi together it works - thank you.

But now another issue occured. Is there any possibility that my AVG () takes only values into consideration if there is a number greater than 0? For example I had a case where my database extracted only 5 days instead 7.