Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
cbournac38300
Contributor
Contributor

Try to get conditionnal sum.

 

Spoiler
Hello everyone,



I am trying to do I thought quite simple and don't manage 😞 

I hope I can learn with your help.



I have a file of fact described s 



Date and Quantity

In the file you can get several lines for the same date.


20/03/2021;10

20/03/2021;20

15/03/2021;15

12/03/2021;5

What I would like to get is 
- Sum of quantity per date ==> ok for me = sum(Quantity)

- Sum for Quantity of the last past 7 days 

In my case what I expect for this colum

20/03/2021 ==> 10+20+15 = 45

15/03/2021 ==> 15+5

12/03/2021 ==> 5



In the load section I add 2 columns : BOP7 == Date-7 and EOP7 = date 

I check that BOP7 et EOP7 have good values

=sum({$<[Date]={">=$(=Only(BOP7))<=$(=Only(EOP7))"}>} Quantity)

results is 0 😞

I think something is missing or not done in the correct way



I hope you can help



Thank's in advance





 

 

2 Replies
eddie_wagt
Partner - Creator III
Partner - Creator III

Hello @cbournac38300 

I think a solution is to use a calendar table, then you can easily use the rangesum function.

rangesum(above(sum({1}value),0,7))

 

eddie_wagt_1-1617359315447.png

 

Regards

Eddie

 

cbournac38300
Contributor
Contributor
Author

Thanks Eddie, 

To be honnest it was my first idea... and I don't know how I wrote my formula before because I didn't get the result... Reading your answer I tried again... and it's ok for me.

 

Thank's for you help.

 

Take Care