PowerBI时间序列图 [英] PowerBI Time Series chart

查看:566
本文介绍了PowerBI时间序列图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我试图在powerBI报表构建器中绘制时间序列上的值。我目前正在从关系型MSSQL数据库中获取数据。现在,此值(UnitCapacity)具有开始日期和结束日期。因此,我要做的是使用mquery在powerbi中创建日期时间维度,以复制特定年份与另一年份之间的日期。我想做的是在时序图上绘制单位容量。然后我创建了过滤器,以便可以选择要绘制的炼油厂单元。

So I am trying to plot a value over a time series in powerBI report builder. I am currently getting the data from a relational MSSQL database. Now, this value (UnitCapacity) has a StartDate and an End Date. So what I have done is created a date time dimension inside powerbi using an mquery to replicate the days between a particular year and another. What I am trying to do is to plot the Unit capacities over a time series chart. Then I created filters so that I can choose which Refinery unit to plot.

因此,我试图解决该问题的方法是通过在句柄上创建IIROutagesDenormalized和DateTimeDim之间的关系。句柄的格式如下:{YYYY}-{MM}-{DD}。这是正确的方法吗?

So how I tried to tackle it is by creating a relationship between the IIROutagesDenormalised and DateTimeDim over the handle where the handle is in this format: {YYYY}-{MM}-{DD}. Is this the right way to do this please?

当我尝试创建DAX查询以获取日历日期维度时,这给了我以下错误:

When I tried to Create the DAX query to get the Calendar date dimension, this is giving me the error below:

推荐答案

您不需要照顾日期格式,因为只要数据类型正确,它就应由Power BI处理。不确定业务逻辑,但使用DAX的方法更简单。

You don't need to take care of the date format because it should be handled by Power BI, as long as the data type is correct. Not sure about the business logic but there is a simpler way using DAX.

您可以使用DAX创建日历表:

You can create a calendar table using DAX:

DateTimeDim = CALENDAR(MIN(IIROutagesDenormalised[OutageStartDate]), MAX(IIROutagesDenormalised[OutageEndDate]))

哪个返回带有Date列的表。

Which returns a table with column Date.

如果在 Date 列和 OutageStartDate 之间创建关系:

If you create a relationship between the Date column and OutageStartDate:

通过简单的度量(取决于业务逻辑),例如

With a simple measure (depending on the business logic), like

Total = SUM(IIROutagesDenormalised[UnitCapacity])

您可以绘制以下内容:

You can plot something like the following:

以下过滤器也可以使用:

Which also works with the filter:

这篇关于PowerBI时间序列图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆