Forum Discussion
RashmitaR
10 years agoHelper IV
Dax
Hi , I have a dataset with one of its column as date and one more as close price ,I wanted to find the average of close price for the last 7 dates present in my date column for every row.For eg ...
Sean
10 years agoCommunity Champion
RashmitaR This Measure should work... Let me know.
7 Day Avg =
DIVIDE (
CALCULATE (
SUM ( Table[Close Price] ),
DATESINPERIOD ( Table[Date], LASTDATE ( Table[Date] ), -7, DAY )
),
CALCULATE (
DISTINCTCOUNT ( Table[Date] ),
DATESINPERIOD ( Table[Date], LASTDATE ( Table[Date] ), -7, DAY )
),
0
)