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

问题描述

在这里添加我以前的问题:



对于每个单元名称,我都有单元容量的开始和结束日期,如下PowerBI表中所示:





4个子问题:


  1. 如何随着时间推移绘制这些容量?也许使用某些DAX功能?

  2. 我是否需要SSAS多维数据集来解决此问题,或者我可以在PowerBI桌面内完成所有工作吗?如果没有,是否有更好的方法例如在SSRS中?

  3. 是否有一种方法可以使x轴时间序列如用户指定的那样动态?

在伦纳德的回应之后,添加到此。转换OutageStartDateOrig和OutageEndDateOrig值后,我尝试按照youtube链接{

解决方案

要创建这样的视觉效果,我建议使用面积图(或堆积面积图),其中日期在轴上,单位名称在图例上,容量在值上。您也可以将其作为堆积的柱形图来进行。但是,每个日期将分为多个离散列。见下图。



在数据处理方面,您需要将上面具有日期范围的数据转换为每个日期&的行。单元。例如。第一行而不是11/2到13/2,将扩展为3行,每个日期一行。



您可以在Power Query中执行以下操作您可以将数据带入Power BI Desktop或带入DAX之后。在该线程中概述了几种解决方案(



区域图在顶部,柱状图在底部,日期分片器将正确过滤1月至3月。


Adding on my previous question here: TimeSeries question

I would like to plot a unit capacity chart over a Time series (which contains a range of dates set by the user).

The chart I am trying to plot is as follows:

For each Unit Name, I have start and end date for the unit capacities, as shown in the PowerBI table as below:

4 sub questions:

  1. How to plot these capacities over time? Maybe using some DAX functions?
  2. Do i need the SSAS cube to solve this problem or can I do all the work inside PowerBI desktop? If not, is there a better way for example in SSRS?
  3. Is there a way to make the x-axis time series dynamic as specified by the user?

Adding to this, after Leonard's response. After converting the OutageStartDateOrig, and OutageEndDateOrig values I tried to create the calculated column as suggested in the youtube link {enter link description here}. However, the DAX formula as shown in the video gives out a syntax error for me stating that the '.' is incorrect when specifying the range of dates. Any ideas for this? [Screenshot below]:

解决方案

To create such a visual, I'd recommend an area chart (or stacked area chart) with the date on the axis, the unit name on the legend, and the capacity on the values. You could also do it as a stacked column chart too. However, then each date will be broken into discrete columns. See below image.

In terms of data manipulation, you'll need to convert the data with the date ranges you have above into a row for each individual date & unit. E.g. the first row, instead of being 11/2 to 13/2, would be expanded into 3 rows, one for each date.

You can do this in Power Query as you bring the data into Power BI Desktop, or in DAX after bringing it in. There are several solutions to this outlined in this thread (https://community.powerbi.com/t5/Desktop/Convert-date-ranges-into-list-of-dates/td-p/129418), but personally, I recommend the technique (and video) posted by MarcelBeug (https://youtu.be/QSXzhb-EwHM).

You'll also want an independent list of dates (with no gaps) to join the final date column to - otherwise your visual will skip dates when no units had capacity. By default, the chart will begin on the first date with data and end on the last date with data, so in that sense it is dynamic, but you can add a date slicer to give the end-user more control.

Area chart on top, column chart on bottom, date slicer on right filtering Jan-Mar.

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

08-11 14:26