Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Sam_Thomas
Creator
Creator

Sum If within the last year

Hi All, 

I am looking for an expression that SUM's a field total (DeliveryQuantity) if another field date (DateEnded) is within the last 365 days. 

I want to show the live total based on today-365. 

Thanks. 

Labels (1)
1 Reply
rubenmarin

Hi,it could be something like:

Sum({<DateEnded={">=Today()-365"}>} DeliveryQuantity)

or Sum({<DateEnded={">=$(=Date(AddYears(Today(),-1)))"}>} DeliveryQuantity)

or flag the records while loading data: If(DateEnded>=Today(1)-365, 1, 0) as is365Days. then you can use Sum({<is365Days={1}>} DeliveryQuantity)