DAX running total (or count) across 2 groups

后端 未结 1 1436
[愿得一人]
[愿得一人] 2020-12-12 02:27

I\'m very new to DAX and PowerPivots. I am using PowerPivot to pull data from an SQL server. The data I\'m working with is pretty large and complex but I\'m considering a si

相关标签:
1条回答
  • 2020-12-12 03:17

    You can make a calculated measure in PowerPivot to handle this. If you want to get the cumulative sales for all time you can do this:

        CALCULATE(     SUM( FactSales[SalesAmount] ),
        FILTER(
            ALL( DimDate) ,
            DimDate[Datekey] <= MAX( DimDate[Datekey] )
        )
    )
    

    If you want to be able to select certain time period (ex: running total for selected weeks or months) you can do this:

     CALCULATE( SUM( FactSales[SalesAmount])  ,
                     FILTER(
                        ALLSELECTED( DimDate),
                        DimDate[Datekey] <= MAX( DimDate[Datekey] )
                    )
        )
    

    Source: Javier Guillen's blog

    0 讨论(0)
提交回复
热议问题