Forum Discussion
Birdie
6 years agoRegular Visitor
Calculate a value based on values in same column
Hi all, I hope this is a simple request. I have 3 columns of data: 1. Date/time - 10 second intervals 2. Value - integers increasing 3. Index - starts at zero and increases It looks like this:...
- 6 years ago
So, as a calculated column you could do this:
Column = VAR __index = [Index] VAR __index30 = [Index] - 3 RETURN IF(__index30 < 0,BLANK(), VAR __value = [Value] VAR __value30 = MAXX(FILTER(ALL(bottles),[Index] = __index30),[Value]) RETURN (__value - __value30) * 2 )
Greg_Deckler
6 years agoCommunity Champion
So, as a calculated column you could do this:
Column =
VAR __index = [Index]
VAR __index30 = [Index] - 3
RETURN IF(__index30 < 0,BLANK(),
VAR __value = [Value]
VAR __value30 = MAXX(FILTER(ALL(bottles),[Index] = __index30),[Value])
RETURN (__value - __value30) * 2
)- Birdie6 years agoRegular Visitor
in your solution, what is (bottles)?
DAX is returning an error on that - Failed to resolve name 'bottles'. It is not a valid table, variable, or function name.- Greg_Deckler6 years agoCommunity Champion
Replace "bottles" with the name of your table where you are creating the column.