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

Get sum of sales on max(sold date)

hi,

i have a requirement that i need to get sum of sales that are sold on max date among the existing sold date.

i tried with the expression "sum({$<YEAR = {$(=max(YEAR))}, MONTH = {$(=max(MONTH))}>} Sold_Date) "

but not giving me any result.

can anybody suggest me where i am wrong ?

Thanks

Charitha

6 Replies
tresesco
MVP
MVP

In such case, a sample qvw would help get fastest resolution. Among many possiblities, one issue could be: Max() returning numeric value while you have months like Jan, Feb..

agomes1971
Specialist II
Specialist II

Hi,

please use always this link when building set analysis statements...

Set Analysis Wizard for QlikView | qlikblog.at

I think it should help you...

Regards

André Gomes

Not applicable
Author

go for

firstsortedvalue(sales,-max date)   , instead of max date use ur field like ,date ,max date .....

u will get top max value

Not applicable
Author

sum({1< DateField= {'=$(vMaxDate)'} >} SalesAmount )

with the variable vMaxDate: " =Date(Max({1}DateField)) "

should do the trick

Not applicable
Author

Hi Lakshmi,

if you have date field in your script then you can directly use

sum({$<SoldDate={$(=max(SoldDate))}>}sales)

if you want always to calculate max of select date, by disregarding selection you can use

sum({1<SoldDate={$(=max(SoldDate))}>}sales)


With Regards

Harshita Gaur

Not applicable
Author

Hi lakshmi ,

did u tried my one

firstsortedvalue(sales,-max date)   ,   instead of max date use ur field like   ,date ,max date ,sold date  which u have  ...

u will get top max value