【问题标题】:Previous period calculation in Azure Data Explorer\KustoAzure 数据资源管理器\Kusto 中的前期计算
【发布时间】:2019-05-30 11:23:08
【问题描述】:

我们正在 Power BI 中针对 Azure Data Explorer 中的数据构建报告。因为我们需要报告是完全动态的,所以我们不能预先编写查询,但必须依赖 Power BI 来根据数据资源管理器生成查询到用户对报告的操作。

我们的要求之一是显示与上一期间(月)的值相比的多个度量值。该度量还必须是非常动态的,因此正确的值必须基于用户过滤器和操作,并且不能预先计算。

我们在 Power BI 中添加了计算度量:

Prev_Month_Amt=CALCULATE(SUM(sales[Amt]),DATEADD(dates[Record_DT],-1,MONTH))

日期表每天包含一行,并使用多对一关系链接到 Power BI 中的销售表。 sales 表包含数亿条记录。

问题在于,当我们将 Prev_Month_Amt 度量添加到像 Matrix 这样的 Power BI 对象时,我们遇到了非常长的运行时间,并且经常出现“ge Accumulated string array getting too large”错误。

有没有更好的方法在基于 Azure 数据资源管理器的 Power BI 中构建前期计算?

谢谢, H.G.

【问题讨论】:

    标签: powerbi azure-data-explorer


    【解决方案1】:

    您可以将上个月的金额列添加到提供给 PBI 的 Kusto 表中(通过使用更新策略或 Microsoft 流将其添加到真实表中,或者通过在存储函数中扩展它)。 PBI 会将其视为常规列,这是一个示例:

    let T = datatable(Amount:double, Day:datetime, LineItem:string, Account:string) 
    [2, datetime(2019-01-03), "revenue", "a",
    2, datetime(2019-01-05), "revenue", "a",
    5, datetime(2019-01-03), "revenue", "b",
    5, datetime(2019-01-05), "revenue", "b",
    10, datetime(2019-02-07), "revenue", "a",
    2, datetime(2019-02-10), "revenue", "a",
    3, datetime(2019-02-10), "revenue", "b",
    4, datetime(2019-02-10), "revenue", "b"
    ];
    T
    | extend Month = startofmonth(Day)
    | summarize Amount = sum(Amount) by Month, LineItem, Account
    | join kind=leftouter 
     (
        T 
        | extend Month = startofmonth(endofmonth(Day) + 1d) // sets the current month to the next month
        | summarize LastMonthAmount= sum(Amount) by Month, LineItem,  Account
    ) on Month, LineItem, Account
    | project Month, LineItem,  Account, Amount, LastMonthAmount
    

    【讨论】:

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