Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Show sales value for maximum date

Hi,

I'm trying to build an expression that will show sales value for one maximum date of the year (31.12) and user will be able to choose only year. So for example if I choose 2010 I want expression to show me the value for 31 December 2010.

How can I do that? Please help

1 Solution

Accepted Solutions
Not applicable
Author

Thank you everyone for the help. I don't know why my expression always shows 0... Maybe I've done something wrong...

I found a solution for this. It's about creating a variable Maxdate=max(Date) and then writing the expression:

=sum(if(Date=MaxDate,Sales)).

View solution in original post

9 Replies
Not applicable
Author

Hi,

would be something like

sum({<Date={'$(=max(Date))'}>} Sales)

Regards,

Björn

tresesco
MVP
MVP

Hi Paulina,

probably set analysis can help you out. write your expression somewhat like :

sum( {$<Date_month = {31-Dec}>} Sales ). This is possible when you have already created a field 'Date_month' at the backend with the similar('DD-MM') format.

tresesco
MVP
MVP

Bjorn's way is perfect if you want it for maxdate. But if you are asking for specifically 31st Dec, then you have to go with my option.(Note: difference between these two is, if there is no transaction for 31st dec, my expression would return zero, while Bjorn's would find the next maxdate, may be 30th Dec or whichever available and return sales amount for that day).

CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     You can try with this expression

     Sum({<Date={'$(=YearEnd(MakeDate(Max(Year))))'}>} Sales)

Celambarasan

Not applicable
Author

Actually the 31 Dec is an example, not the fixed date I want to use. I don't know why but the expression gives me 0 as a result (the one proposed by Björn and ).

The thing is that I have accumulated data - for example December data= November data + December sales data, for November I have October + November etc. So I have to show data for the one, maximum date to have a value that gives me the year total. But I also want to have it if I select only quarter - then I want to show the data for the last day of the quarter. So the 31 december isn't an option for me.

CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     You can try with this expression

     Sum({<Date={'$(=MakeDate(Max(Year),Max(Month),Max(Day))'}>} Sales)

This may be your need

Celambarasan

Not applicable
Author

Thank you everyone for the help. I don't know why my expression always shows 0... Maybe I've done something wrong...

I found a solution for this. It's about creating a variable Maxdate=max(Date) and then writing the expression:

=sum(if(Date=MaxDate,Sales)).

sathishbabu_s_g
Contributor III
Contributor III

Hi,

You can also try below, where MaxDate is the variable of below expression

Let MaxDate = max(date);

=Sum({$<date = {'$(=date(MaxDate))'}>} Value)

sakshikaul
Creator II
Creator II

I need same thing to implement using calendar variables