【发布时间】:2020-05-29 20:55:24
【问题描述】:
Power BI 新手在这里。
我想根据我的 Azure DevOps 数据 (https://docs.microsoft.com/en-us/azure/devops/report/powerbi/sample-test-plans-execution-trend?view=azure-devops&tabs=powerbi) 构建示例报告中所示的 Power BI 可视化。
使用 DateSK 制作 X 轴似乎不起作用,因为 PowerBI 将其视为一个整数,并且我的可视化中 X 轴的方式是线性的(绘制的 X 轴如下所示:20200100 20200150 20200200 20200250 等等上)。我想查看 Microsoft 文档中显示的每日视图。
PowerBI 也不允许我将 DateSK 数据类型从整数转换为日期格式。
我曾尝试在我的 Power BI 查询中使用 $expand,但似乎日期列无法让我扩展或者我做错了。
如果您有任何解决方法或使用$expand 查询的方法,请告诉我。我想查看扩展的日期格式而不是 DateSK。
下面是来自微软文档的参考,如上面的链接所示:
let
Source = OData.Feed ("https://analytics.dev.azure.com/{organization}/{project}/_odata/v3.0-preview/TestPointHistorySnapshot?"
&"$apply=filter((TestSuite/TestPlanTitle eq '{testPlanTitle}') and (DateSK ge {startDate} and DateSK le {endDate}))"
&"/groupby("
&"(DateSK),"
&"aggregate("
&"$count as TotalCount,"
&"cast(ResultOutcome eq 'Passed', Edm.Int32) with sum as Passed,"
&"cast(ResultOutcome eq 'Failed', Edm.Int32) with sum as Failed,"
&"cast(ResultOutcome eq 'Blocked', Edm.Int32) with sum as Blocked,"
&"cast(ResultOutcome eq 'NotApplicable', Edm.Int32) with sum as NotApplicable,"
&"cast(ResultOutcome eq 'None', Edm.Int32) with sum as NotExecuted,"
&"cast(ResultOutcome ne 'None', Edm.Int32) with sum as Executed
)
)", null, [Implementation="2.0"])
in
Source
【问题讨论】: