How to sum a set of values that lie between a start date and an end date?
Asked Answered
S

1

5

I have created two dropdown list

 1. start date 
 2. end date

I am using MySQL database as a source and I have a table called generation having columns like (date , generation, turbine_id).

After selecting the start date and end date, I need to sum the corresponding values that lie between the two dates:

sum({<Date= {"<=$(=vStartDate)>=$(=vEndDate)"}> } Target)
Sebaceous answered 5/11, 2012 at 10:14 Comment(2)
sum({<Date= {"<=$(=vStartDate)>=$(=vEndDate)"}> } Target)Sebaceous
Try looking for Interval Match on the Qlikview Syntax ReferenceNighthawk
O
11

I see that you already made two variables, vStartDate and vEndDate, So you can manipulate them using a Calendar or an Input Box.

In this case your set expression is almost good. It sould look like this:

Sum({$<Date = {">=$(=vStartDate)<=$(=vEndDate)"}>} Target)

So in the curly bracket it starts with a $ sign, which represents the current selection, which will be filtered by the expression. In the double quotes you tell that the value of Date should be bigger or equal than the evaluated =vStartDate expression (evaluation is done by using a dollar-sign expression), and less than vEndDate. This is how it works.

Overblown answered 9/11, 2012 at 8:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.