Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Get max date from last month variable

Hello,

The vlastmonth is a variable used to compute total. My question is how to get only the very latest date and its corresponding ie

25/09/2014     5,244.31

Tried to use the firstsortedvalue(amount,-Date) but returned null.

Please help

Capture.PNG

6 Replies
MK_QSL
MVP
MVP

firstsortedvalue(Distinct amount,-Date)

Not applicable
Author

Hi,

you can use the below to get sales on latest date.

sum({<Date={'(=$(Max(Date)))'}>}amount)

Anonymous
Not applicable
Author

Hi Joe,

For the vLastMonth the last transactional date is 25/09/2014 not the the 30/09/2014 as we all know. The requirement is to display the amount for the last transactional date.That is where my challenge layst.

Manish and Shruthi I didn't get the desired results.

So how can I get the max date from the vlastMonth variable

Not applicable
Author

How have you defined vLastMonth? Should be able to just Max() on that to give you the date then

Anonymous
Not applicable
Author

vLastMonth=Month(date(AddMonths(max(Date), -1)))

Perhaps it's the date format?

Not applicable
Author

hello

if you mean by that you  want the maximum date  and its corresponding amount no matter what the active selection is you could create a variable  for example vDateMax et put the following in it

=date(max({1}Date)) 

this will give the latest date no matter the selection and to get its corresponding amount

=only({<Date={"$(vDateMax)"}>}montant)

other wise to get the latest date and its amount , taking into account selections, you need to put =date(max(Date))  in 

vDateMax .

See if it helps

Regards