powerbi, 求前12个月平均数
平均数 = VAR CurrentYearMonth = '按月汇总表'[年月] VAR CurrentYear = INT(CurrentYearMonth / 100) VAR CurrentMonth = MOD(CurrentYearMonth, 100) VAR StartYearMonth =IF( CurrentMonth <= 12,(CurrentYear - 1) * 100 + CurrentMonth, CurrentYear * 100 + (CurrentMonth - 12)) RETURN CALCULATE(AVERAGE('按月汇总表'[总数量]), FILTER(ALL('按月汇总表'),'按月汇总表'[年月] > StartYearMonth && '按月汇总表'[年月] <= CurrentYearMonth )