【问题标题】:DAX measure to get the total loan amount of the previous 12 month from the selected month in PowerBIDAX 度量从 PowerBI 中的选定月份获取前 12 个月的总贷款金额
【发布时间】:2020-11-25 07:20:22
【问题描述】:

例如:如果我从日期切片器中选择 2019 年 2 月,我想要从 2019 年 3 月到 2020 年 2 月的总贷款金额,给出开始日期和结束日期
例如:我想以类似的方式:

来自给定的 DAX。对于 3 月的特定月份,我得到了正确的 o/p,但是当我从切片器中选择日期时,我想要整个前 12 个月:


    abc =
    CALCULATE(
        SUM( Pledge[pledge_amount] ),
        FILTER(
            Pledge,
             ( Pledge[ft_start_date] >= MIN( 'Calendar'[Date] ) )
                && Pledge[ft_start_date] <= DATE( 2020, 05, 31 )
                && Pledge[ft_end_date] > DATE( 2020, 03, 31 )
                && COUNTROWS(
                    FILTER(
                        'Age Group',
                        'Age Group'[object] = "pledge"
                            && 'Age Group'[units] = "month"
                            && [Age Months] >= 'Age Group'[min]
                            && [Age Months] <= 'Age Group'[max]
                    )
                )
        )
    )

【问题讨论】:

    标签: powerbi dax


    【解决方案1】:

    我们将期望的结果称为移动年度总数,这可以通过使用 DATESINPERIOD 函数来完成。

    使用此代码:

    abc =
    CALCULATE(
     SUM(Pledge[pledge_amount]),
     DATESINPERIOD ('Calendar'[Date],LASTDATE('Calendar'[Date]),-1,YEAR)
    )
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-08-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多