Forum Discussion
Anonymous
6 years agoNot applicable
Filter table by previous date
Hello everyone! I am new to DAX but I have a situation here that I thought I got right but apparently I didn't. I have two tables one Run Info and another Runtime Info. Both have Date columns but ...
- 6 years ago
Anonymous
Use a Date calendar
If you have continuous dates
Day behind Sales = CALCULATE(AVERAGE('Runtime Info'[Event Time]),dateadd('Date'[Date],-1,Day))
If the last date is not -1 day, last date with Data
Last Day Non Continous = CALCULATE(AVERAGE('Runtime Info'[Event Time]),filter(all('Date'),'Date'[Date] =MAXX(FILTER(all('Date'),'Date'[Date]<max('Date'[Date])),'Date'[Date])))
Mariusz
6 years agoCommunity Champion
Hi Anonymous
Try this
Previous Average Event Time =
VAR __previusDate = SELECTEDVALUE( 'Run Info'[Previous Date] )
RETURN
CALCULATE(
AVERAGE( 'Runtime Info'[Event Time] ),
ALL( 'Runtime Info' ),
'Runtime Info'[Date] = __previusDate
)
Best Regards,
Mariusz
If this post helps, then please consider Accepting it as the solution.
Please feel free to connect with me.
LinkedIn
Mariusz
If this post helps, then please consider Accepting it as the solution.
Please feel free to connect with me.
Anonymous
6 years agoNot applicable
Hi Mariusz
Thank you for your reply! I tried it and I got the following data. So something good is happening but it's not quite there yet. Any thoughts?