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: 
lukacvetko
Partner - Contributor II
Partner - Contributor II

Sum of Values from this date and 2 dates back

Hello everyone,

In a picture below, there is a problem I'm facing. I believe the solution can't be that hard, but iz seems that I'm missing it.

Simple Sales data (sales and calendar table in data model).

Straight table that contains "Date" dimension and  expression "sum of Quantity on that Date + Previous 2 Dates".

WantedValue in picture is something that I want, but can't figure out how.

Additional Note: Calculation should be aware that there could be data before 1.7.2016 and has to take it into account.

Pic1.PNG

Thank you.

Regards,

Luka

14 Replies
lukacvetko
Partner - Contributor II
Partner - Contributor II
Author

Hi. Close, but it still doesn't solve 2 problems that I mentioned in a reply to Sravanthi Aluvala.

MK_QSL
MVP
MVP

I have reduced data from your application and added few codes in script as well.

Let me know whether this will help you or not.

Regards,

MK

lukacvetko
Partner - Contributor II
Partner - Contributor II
Author

Manish,

Thank you very much. I believe this is a right solution.

Just one additional question, why *avg(1) ?

Regards,

Luka

MK_QSL
MVP
MVP

It's a dummy field which will not make any changes.. but without that if you select any month, year or any calendar field, it will not ignore those lines..

Just remove Avg(1) from my expression and select any monthyear and see the effect. You will understand.

lukacvetko
Partner - Contributor II
Partner - Contributor II
Author

Understood. Thanks again.