Forum Discussion

mrbajana's avatar
mrbajana
Icon for Helper III rankHelper III
2 years ago
Solved

Rolling Average considering Blank Dates

I have a model with the Fact table and the date dimension. How can I rolling average by n days considering the dates that do not have sales included within a 7-day moving average, for example?   ...
  • CoreyP's avatar
    2 years ago

    Try replacing blanks with 0.

     

    Ventas = IF( ISBLANK(SUM([value])), 0, SUM([Value]) )

  • Ashish_Mathur's avatar
    2 years ago

    Hi,

    This pattern should work

    Measure = divide(calculate([Amount],datesbetween(calendar[date],min(calendar[date])-6,max(calendar[date]))),7)

    Hope this helps.