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

StackOverflow https://stackoverflow.com/questions/13229966

  •  27-11-2021
  •  | 
  •  

質問

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)
役に立ちましたか?

解決

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.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top