Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sum of Last 90 Days

I need to calculate the sum of the last 90 days. I've tried this but does not work.

=Sum({<Date_Key = {'>=$(=Date_Key(Max(Date_Key)-90))'}>}InvoicedQuantity)

What am i doing wrong?

7 Replies
Anonymous
Not applicable
Author

Hi

try this :

=Sum({<Date_Key= {">=$(=Date(Today()-90,'MM/DD/YYYY'))<=$(=Date(Today(),'MM/DD/YYYY'))"} InvoicedQuantity)

Higlhlighted : Please use appropriate date format .

Gysbert_Wassenaar

I assume Date_Key is a field. It's not a function in any case so Date_Key( ...something... ) won't do anything.

=Sum({<Date_Key = {">=$(=Date(Max(Date_Key)-90,'MM/DD/YYYY'))"}>}InvoicedQuantity)


Change MM/DD/YYYY to whatever the actual date format of your Date_Key field is. And if Date_Key does not contain date values then replace it with a field that does contain date values.


talk is cheap, supply exceeds demand
Not applicable
Author

I tried to modify it like this

=Sum({<DateName = {">=$(=Date(Max(DateName)-90,'YYYY/MM/DD'))"}>}InvoicedQuantity)

DateName is this format: 2016/01/01.

But still no luck

Gysbert_Wassenaar

Check that your dates are actually dates and not just text values that look like dates. What does =Num(DateName) return in a text box?


talk is cheap, supply exceeds demand
Not applicable
Author

It give me nothing.

just a "-"

tyagishaila
Specialist
Specialist

What is showing in text object after selecting any one date from DateNum field.

Gysbert_Wassenaar

Then your DateName values are text, not dates. Use a real date field or use the Date# function in the script to make real dates from the text values.


talk is cheap, supply exceeds demand