//past 3 month offtake avg
var P3M=CALCULATE([BD_Offtake],DATEADD('ePOS-DIM-Calendar'[Date],-3,month))
var P1M=CALCULATE([BD_Offtake],DATEADD('ePOS-DIM-Calendar'[Date],-1,month))
var p2m=CALCULATE([BD_Offtake],DATEADD('ePOS-DIM-Calendar'[Date],-2,month))
//存在过去三个月data为空情况
var P3M_flag=IF(OR(P3M=0,ISBLANK(P3M)),0,1)
var P1M_flag=IF(OR(P1M=0,ISBLANK(P1M)),0,1)
var P2M_flag=IF(OR(P2M=0,ISBLANK(P1M)),0,1)
return
DIVIDE((P3M+P1M+p2m),(P3M_flag+P1M_flag+P2M_flag))
网友评论