Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Save the Date: QlikWorld Online, June 24-25, 2020. Free global virtual event for data integration and data analytic gurus. Register Today
Highlighted
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
Highlighted
Not applicable

Show sales value for maximum date

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
Highlighted
Not applicable

Show sales value for maximum date

Hi,

would be something like

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

Regards,

Björn

Highlighted
MVP
MVP

Show sales value for maximum date

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.

Highlighted
MVP
MVP

Re: Show sales value for maximum date

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).

Highlighted

Show sales value for maximum date

Hi,

     You can try with this expression

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

Celambarasan

Highlighted
Not applicable

Show sales value for maximum date

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.

Highlighted

Show sales value for maximum date

Hi,

     You can try with this expression

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

This may be your need

Celambarasan

Highlighted
Not applicable

Show sales value for maximum date

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

Highlighted
New Contributor III

Re: Show sales value for maximum date

Hi,

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

Let MaxDate = max(date);

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

Highlighted
Contributor II

Re: Show sales value for maximum date

I need same thing to implement using calendar variables