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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
whijo32
Contributor
Contributor

Sum of a value between two dates

I currently have two separate tables joined in Qlik.  One has a report date with all the KPI's each day and the second table has a date of completion where an issue was addressed.

I  am trying to measure  the sum of a value 30 days before and 30 days after from the date of completion by using the data from the report date table.

I have two variables set up currently: v30DaysAfter = (Date of Completion+30) and v30DaysBefore = (Date of Completion-30).

I scrubbed through these forums to find similar issues and have a formula that is close to doing the job, but not quite working. 

sum({$<DateOfCompletion = {">=$(DateOfCompletion)<=$(v30DaysAfter)"}>}VALUE)

and

sum({$<DateOfCompletion = {">=$(v30DaysBefore)<=$(DateofCompletion)"}>}VALUE)

When I run these two calculations, I am getting 0.00 for the sum of value when I'm just wanting to get the sum of value for 30 days before and then 30 days after.

Please let me know if I can provide to anymore information.

1 Solution

Accepted Solutions
vikasmahajan

sum({$<DateOfCompletion = {">=$(DateOfCompletion)<=$(v30DaysAfter)"}> + <DateOfCompletion = {">=$(v30DaysBefore)<=$(DateofCompletion)"}> } VALUE)

Refer this https://community.qlik.com/t5/QlikView-App-Dev/quot-OR-quot-Condition-in-Set-Analysis/td-p/695709

         https://community.qlik.com/t5/QlikView-App-Dev/AND-OR-combination-condition-in-set-analysis/td-p/786...

Thanks

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.

View solution in original post

1 Reply
vikasmahajan

sum({$<DateOfCompletion = {">=$(DateOfCompletion)<=$(v30DaysAfter)"}> + <DateOfCompletion = {">=$(v30DaysBefore)<=$(DateofCompletion)"}> } VALUE)

Refer this https://community.qlik.com/t5/QlikView-App-Dev/quot-OR-quot-Condition-in-Set-Analysis/td-p/695709

         https://community.qlik.com/t5/QlikView-App-Dev/AND-OR-combination-condition-in-set-analysis/td-p/786...

Thanks

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.