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: 
AjosefMD
Contributor
Contributor

SUM with different Date Ranges

Dear Community,

I need to sum (total) Quantities with different Date-Ranges. 

In the yellow example I need for Date "06.10.2020" the sum of all Quantities between 06.10.2020 and 15.12.2020. Same for e.g. green. I need sum of Quantities between "30.11.2020" and "08.02.2021".qv.jpg

Maybe you have a working solution for me.

Thank you,
Josef

Labels (1)
1 Solution

Accepted Solutions
Vegar
MVP
MVP

It looks like your intervals are static, what if you use intervalmatch() to solve this this problem?

Vegar_0-1602155764885.png


LOAD
    Material,
    Date,
    Quantity
FROM SOURCE;


IntervalMatch (Date)
LOAD
    StartDate,
    EndDate
FROM SOURCE;

View solution in original post

4 Replies
Taoufiq_Zarra

@AjosefMD  like ?

Sum({<Date={"$(= '>=' & '06.10.2020' & '<=' & '15.12.2020')"}>} Quantity)

and


Sum({<Date={"$(= '>=' & '30.11.2020' & '<=' & '08.02.2021')"}>} Quantity)

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
AjosefMD
Contributor
Contributor
Author

Yes, but the Date Range needs to be calculated new for each row and each Start-/EndDates. So I can not enter fix Dates like this.

Vegar
MVP
MVP

It looks like your intervals are static, what if you use intervalmatch() to solve this this problem?

Vegar_0-1602155764885.png


LOAD
    Material,
    Date,
    Quantity
FROM SOURCE;


IntervalMatch (Date)
LOAD
    StartDate,
    EndDate
FROM SOURCE;

AjosefMD
Contributor
Contributor
Author

Thank you very much! It works perfect :).