Skip to main content
Announcements
MAINTENANCE ALERT: Dec. 12th starting 9 AM CET. Community will be read-only. GET DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
timmy
Partner - Contributor III
Partner - Contributor III

if function not working

Hey,

i have a problem with the function underneed!!

=



Count (Distinct ( If ( (ShipDate - DueDate) <= 0, if((Fiscal_Year=max(Year),SalesOrderID ))) )

when i try instead of the max(year) just 2009 everything works fine but with the formula is shows nothing.

tnx

1 Solution

Accepted Solutions
tabletuner
Creator III
Creator III

try a variable instead of the fieldname like $(vMaxYear)

where vMaxYear = max(Year)

View solution in original post

8 Replies
brenner_martina
Partner - Specialist II
Partner - Specialist II

Hi,

it can not work if number of brackets are wrong:Count(Distinct (If(ShipDate - DueDate) <= 0, if(Fiscal_Year=max(Year),SalesOrderID )))



mihaiturturica
Partner - Contributor III
Partner - Contributor III

Hi,

Create a variabile

Let vMaxYear = max(Year)

and use this:

Count (Distinct ( If ( (ShipDate - DueDate) <= 0, if((Fiscal_Year=$(vMaxYear),SalesOrderID ))) )

Mihai

Not applicable

its your second if command you have an extra set of brackets that arent neccessary. so your if statement has only 1 parameter instead of 2.

try this.


Count (Distinct ( If ( (ShipDate - DueDate) <= 0, if( Fiscal_Year=max(Year),SalesOrderID ) ))


timmy
Partner - Contributor III
Partner - Contributor III
Author

I have tried all the solutions but nothing is working.

tnx for the replies...

tabletuner
Creator III
Creator III

try a variable instead of the fieldname like $(vMaxYear)

where vMaxYear = max(Year)

timmy
Partner - Contributor III
Partner - Contributor III
Author

I have tried that but when i reload the script is get a error message:

"Aggregation expressions not allowed in GROUP BY clause"

Not applicable

can you attach an example?

tabletuner
Creator III
Creator III

Define the variable in the variable overview ( i believe in the settings menu).

Dont define it in the script because the variable must be dynamically defined during runtime.

good luck