The basic data set looks like this:
FIG 1
What a pre-decessor did with the data set is to make it linear by copying all the data, i.e. saturday -> data, sunday -> data
Like this:
FIG 2
Using this format, he was able to generate a graph like this:
FIG 3
Now, I have started to automate this document, where now, I have got to the stage of automating Fig 1.
My question is, by looking at the graph, is there a way to skip FIG 2 and just generate the graph using the data in FIG 1?
I have spent a couple of hours thinking about this and I cant seem to think of a solution.
I was thinking along the lines of creating a data range with, 00:00, 01:00 ..... and the day data, iterating that for all the days then combining the range to make a mega range, but I can't see how that will work.
Can anyone push me in the right direction to solve this problem?
Thanks
Chris
The only solution I can think of would be to write some vba which creates the fig 1 format from the original format. I'm fairly certain Excel doesn't allow you to draw the chart you want from the data in the original format but the vba should be quite simple.
For readability I'd recommend you transpose the fig 2 data so that it is going down rather than up. The vba should traverse the data and write the chart data rows, then update the chart data source to use your finished range.
That's assuming the number of periods will be changing. If they won't you can just use formulae to rearrange the data and no vba will be required.
Related
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:
How to plot these capacities over time? Maybe using some DAX functions?
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?
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.
I'm using a macro to generate graphs from a table such that the x-axis is a time stamp(date, time) and the y-axis is for the data at that time. So far, there is no problem getting this to work but the result is a graph that has "blank space" before and after the data(roughly 5-10 minutes before and after on a 1-hour time-frame). I have space constraints and this cuts into them so I'd like to utilize the entire plot area. Can I eliminate the blank space by extending the data to end of the plot area somehow? Any help is appreciated.
Additionally the files I need to use are for different time frames and lengths of time(ie, different length of excel rows). Is there a way to only graph the rows with content instead of a "worst-case scenario" like using A2:A100000 because I know it will never be greater than 100,000 rows?
I have some code that retrieves data from a SAS Table on a server. I'm trying to chart this data using VBA, without copying it to an Worksheet first (Feeding the recordset directly into the charts)
I've had success so far with this. The problem is, my charts need to have multilevel categorical X axis, and i'm having trouble automating this only with VBA
What I'm trying to get is something like this
http://imgur.com/ElwHwjE (I can't post the image due to lack of reputation)
But so far all my attempts lead to this
http://imgur.com/id7Vua0
I know I can do this if I first make a Pivot Table from my recordset and then build a chart on top of it, but as stated before I'm trying to do this without copying the data into a Sheet.
Also tried messing with TickLabel options (Multilevel and Depth), but so far to no avail.
I've tried everything I could think of, and I have not been able to create a multiple level categorical axis without having the axis data in a worksheet. I've tried various 1D and 2D arrays, with array elements that include various LF, CR, and CRLF characters. I've tried using the worksheet range, then converting XValues to an array, and of course, this broke the axis without providing a usable array.
Bottom line: Excel charts were designed to plot worksheet data, and you can't always get around this requirement. Most of the time I think you shouldn't waste time trying to get around it.
I have a project that im working on at the moment in VB.
Basically I have a Data Table in VB it populates with 4 columns and a variable number of rows, the column names are as follows;
Gear, RPM, Speed, CO2
The data table appears in datagridview correctly but that's as far as I have gotten :/
What I am trying to do is to make a line chart called mainGraph to draw a graph based on these results, I'm getting stuck when trying to populate the chart.
ANY thoughts would be really appreciated.
I am guessing you are using the ms chart controls and not some 3rd party like Telerik.
This should be usefull http://blogs.msdn.com/b/alexgor/archive/2009/02/21/data-binding-ms-chart-control.aspx
Also, there is source code found at http://archive.msdn.microsoft.com/mschart/Release/ProjectReleases.aspx?ReleaseId=4418
in short this is a way to get things displayed
mainGraph.Series(0).ChartType = DataVisualization.Charting.SeriesChartType.Line
mainGraph.Series(0).Points.DataBind(yourDataTable.DefaultView, "Speed", yourDataTable.DefaultView, "Gear")
These commands should make a line graph with Speed on your x axis, and Gear on your Y. Assigned to "Series(0)"
To add more columns, you need to add more "Series"
mainGraph.Series.Add("RPM")
Do some thinking about how you want this data displayed.
how would you like to set this graph up?
I'm assuming you would want a line graph?
What is going to be the X axis? Is there a missing column that needs to be "time" in the data table?
do you want them all on one graph/chart area?
If you would like more charts, then you need to add chart areas. A series can be assigned to a chart area.
Hopefully this helps.
I need help creating an Excel macro.
I want to take the Excel file here and create a graph of each of the servers with time being the x axis and memory utilizaiton % being the y axis. The problem is, the number of data points for each server can be variable (sometimes the first server has x number of data points, other times it has x+2).
Can anyone help me with this?
Sure. If I'm understanding correctly, you need to create a chart where your data can grow in size. In that case you need to use a "dynamic named range" that expands as new data is added. The chart that you will end up creating is called a "dynamic chart". The dynamic range is set up using the OFFSET function which allows it to expand.
I think these videos will help you:
Excel 2010 / 2007: http://www.youtube.com/watch?v=M9hhUVljTx4
Excel other: http://www.youtube.com/watch?v=7le-m8YRP6M