Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
london1980
Contributor III
Contributor III

Order_Date=max(Order_Date) gives an error in formula

Hi All,

I'm trying to write a conditional sum function.

When I write it like this, it works.

sum(if(Order_Date='18/11/2015',Order_Qty)

But if I want to make the chosen date dynamic as the most recent date in the table, where I'm using max(Order_Date), it gives an error:

Error in Expression

sum(if(Order_Date=max(Order_Date),Order_Qty)

Any idea how to fix this?

thanks..

1 Solution

Accepted Solutions
jagan
Luminary Alumni
Luminary Alumni

HI

Try like this using SEt analysis

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

Hope this helps you.

Regards,

jagan.

View solution in original post

3 Replies
jagan
Luminary Alumni
Luminary Alumni

HI

Try like this using SEt analysis

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

Hope this helps you.

Regards,

jagan.

vipin_mishra479
Creator II
Creator II

Hi Maham

there multiple way you find this answer what ever Jagan has mention this is the one way and another way is

create a variable like

vMaxdate = Date(max(Order_Date),'DD/MM/YYYY')

and use

sum({<Order_Date = {'$(vMaxdate )'}>}Order_Qty)

Try this may be helpful for you

vipin

Anonymous
Not applicable

Try what Jagan and Vipin suggested,

also make sure format should match as max() returns a integer value not a formatted date like ORDERDate