CV(Cx, SearchDays, Stat_If_Tie) Returns the closest value entered for the variable specified. Searches forward and backward and uses the value whose datestamp that is closest to the time being calculated. If there is a tie (e.g. there is a value yesterday and a value tomorrow) it will then use the Stat_If_Tie to calculate the value. Will only search up to the number of SearchDays specifed (forward and backward). If no data is found in either direction the result is a blank. The variable to be searched must be specified as a Conditional Variable (use a "C" instead of a "V").
SYNTAX:
CV(Cx, SearchDays, Stat_If_Tie)
where :
Cx is a conditional variable x
SearchDays: Specifies the number of days to search from the date being calculated (ex. 7 would mean search up to 7 days forward and 7 days backwards for values). SearchDays must be a value other than 0. Keep in mind that as the value of SearchDays increases, the equation may take much longer if it does not find a recent value.
Stat_If_Tie: A quoted string that specfies what to calculate when the 2 values are the same time difference from the slot being calculated.
Stat |
Description |
First |
Use the First (earlier) value |
Last |
Use the Last (later) value |
Avg |
Average the two values |
Min |
Use the minimum of the two values |
Max |
Use the maximum of the two values |
EXAMPLES:
Find closet value from V8005. Search up to 30 days forward and backward for values. If there is a tie, average the two values.
V8060 = CV(C8005,30, "AVG")
Find Closest value from a daily detail variable.
V8023 = CV(C8015,30,"AVG")
Find the closest 4 Hour value into an hourly Calc.
V1271 = CV(1261,7,"MAX") - V1271 is an hourly calc and V1261 is a 4 hour parameter.