Forum Discussion
LFM
2 years agoHelper III
Calculating previous days values
Im trying to calculate previous days exposure for the measure called "prevous days exposure_mwh". It should be the sum of exposure for the last day. I dont get any values as seen in the pictures. What is wrong wilth the calculation?
LFM You are using CALCULATE and TI functions is what is primarily wrong. Do this instead:
Measure = VAR __Date = MAX('NPOSC'[date]) - 1 VAR __Table = FILTER( ALL('NPOSC'), [date] = __Date ) VAR __Result = SUMX( __Table, [exposure_mwh] ) RETURN __Result
1 Reply
- Greg_DecklerCommunity Champion
LFM You are using CALCULATE and TI functions is what is primarily wrong. Do this instead:
Measure = VAR __Date = MAX('NPOSC'[date]) - 1 VAR __Table = FILTER( ALL('NPOSC'), [date] = __Date ) VAR __Result = SUMX( __Table, [exposure_mwh] ) RETURN __Result