📜  滚动总和 - 无论代码示例

📅  最后修改于: 2022-03-11 14:57:57.754000             🧑  作者: Mango

代码示例1
_Allselected_filter_first12 =
VAR _table =
    FILTER (
        ALLSELECTED ( 'Table' ),
        EOMONTH ( 'Table'[Date], 0 ) <= EOMONTH ( MAX ( [Date] ), 0 )
            && EOMONTH ( 'Table'[Date], 0 ) > EOMONTH ( MAX ( [Date] ), -12 )
    )
VAR _sum12 =
    IF ( COUNTROWS ( _table ) = 12, CALCULATE ( SUM ( 'Table'[Sale] ), _table ) )
RETURN
    IF ( HASONEVALUE ( 'Table'[Date] ), _sum12, SUM ( 'Table'[Sale] ) )