Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How i filter the expression with min and max

Hello everybody.

I have an expresion similar that  =sum({<year = {2011,2010}>} profit)

I need sum the profit only a years different from the max of year in this case 2012

If i write =sum({<year={$(=max(year))} profit) run and sum the [profit for the max of year but shows error if i replace the = for the << for given the sum of years that are minor of 2012.

How i write the expresion ?

=sum({<year << $(=max(year))>} profit) shows error.

Thanks in advance.

1 Solution

Accepted Solutions
Not applicable
Author

Hi,

I don't know if I understood your question correctly, so tell me if im wrong okay?^^

For example you have years 2010, 2011, and 2012

do you want to sum the profit of all years (in this case 2010 AND 2011) that are < to your max year(which is 2012)?

if so, can you try this?

sum({<year = {"<$(=max(year))"}>}profit)

or do you want to know only the profit of last year (2011) base on your max year (2012)?

if this is the case then you can try this instead^^

sum({<year = {$(=max(year)-1)}>}profit)

Best Regards,

Alex

View solution in original post

2 Replies
Not applicable
Author

Hi,

I don't know if I understood your question correctly, so tell me if im wrong okay?^^

For example you have years 2010, 2011, and 2012

do you want to sum the profit of all years (in this case 2010 AND 2011) that are < to your max year(which is 2012)?

if so, can you try this?

sum({<year = {"<$(=max(year))"}>}profit)

or do you want to know only the profit of last year (2011) base on your max year (2012)?

if this is the case then you can try this instead^^

sum({<year = {$(=max(year)-1)}>}profit)

Best Regards,

Alex

vincent_ardiet
Specialist
Specialist

Hi,

You can exclude the max year with a minus preceding the equal :

=sum({<year -= {$(=max(year))} profit)

Regards,

Vincent