in my project I have some data organized in this way
Date1 A1 B1 Date2 A2 B2 . . Daten An Bn
The values An e Bn (both number), are calculated with those formulas (vStartDate and vEndDate are variables for the search interval) (colonna_data e Chiarezza are column in my QV db)