Saving Charts with Multiple Series in Excel and PowerPoint - sql

Context
I'm trying to create a multi-series chart/infograph to display total number of sales for the day as compared to the average. The chart consists of three series:
Series 1: The base bar graph showing the number of each item sold
Series 2: A scatterplot to overlay the icons for each item on the appropriate
bar
Series 3: Another scatterplot to overlay the average number of each of the items sold/day
The data is pulled from a SQL server and is automatically refreshed every 5 minutes using Excel's data connections properties.
I have a display in the office that has a PowerPoint running, showing various office events, etc. that I'd like to add this graph to. Typically I would just copy/paste into a slide in the presentation, maintain links, and call it a day. But therein lies the problem...
Issue
When I copy/paste into PowerPoint, only the first series is copied over for some reason. No worries, I thought, I'll just recreate the other two series in PowerPoint directly, linking to the data in Excel. This works until either file is saved/closed. Upon reopening, only the first series remains. For the Excel file, this happens for .xlsx, .xlsm, and .xlsb file types. How can I get charts with multiple series to save properly? Is it more feasible to use code to create the additional series upon opening?
Photos
Desired Result:
After saving/reopening:
Note: I am using Excel 2016 and PowerPoint 2016. Chart similar to what is described in this video: https://www.youtube.com/watch?v=8g9DK5noi1s&t=710s. Tables for series 2 and 3 are in separate tabs due to how the query pulls into Excel. They are the same structure as the table shown, just different values.

Related

VBA AddDataField CubeFields - Error 1004

I'm stumped...been building a PowerPivot sales report over the past few months and teaching myself VBA and DAX along the way. My report has several pre-configured views that can be chosen by VBA buttons, which work completely fine until you close the workbook and re-open it. Every time the workbook is opened for the first time - the VBA code errors out on the first AddDataField CubeFields line of code. It's as if excel does not pre-calculate the measure I am trying to add.
If I manually remove/add a value in the pivot table and then run the VBA code, it runs flawlessly. If I open PowerPivot manage data window and then close it, the VBA code runs perfectly fine. Something about manually changing values in the pivot table or simply opening the PowerPivot data tab, prompts Excel to pre-calculate all measures. Here is the exact line of code that gets hung up every time:
Worksheets("Dealer Install Sales").PivotTables("PivotTable1").AddDataField Worksheets("Dealer Install Sales").PivotTables( _
"PivotTable1").CubeFields("[Measures].[Sum of INVOICE_QTY]"), _
"PIECES"
How do I force excel to automatically calculate all measures upon opening the workbook?
I think what might be going on is the behaviour described in this joy-of-data blog post.
To paraphrase, a measure used in a pivot table which was created outside it, is "forgotten" in certain circumstances. A solution is to create a new measure within the pivot table field list (right click in field list and add measure), which simply references the original measure, e.g. =[measure name].
In your code, refer to the new name of measure, and when you do this, the data model should be stimulated into returning the value of the original measure, instead of falling over.

Use conditional statements to add data to scatterplot

I am new to VBA and have not had experience with creating many charts.The chart has to be created by hand because the data has to be visually inspected to see if it meets certain criteria, and not every cell in a column needs to be added to the chart. The chart is to show information for each asset. Not every asset will have information that can be entered on the graph. Is there a way to use VBA to conditionally add data points to a graph?
For example if an asset sees values between 0-30 plot a dot (green) 30-50 (red) etc.
Such a scenario can be achieved with data layout and formulas. No need for VBA, which would need to be re-run, where as formulas will update automatically.
Consider the following screenshot:
The formula in cell C3 is =IF($B3<30,$B3,NA()) and in D3 =IF($B3>=30,$B3,NA()) copied down.

Programmatically creating multilevel axis chart with VBA on Excel

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.

Creating Power point slides with tables in Excel

I have a large workbook that has several connections and queries to an Oracle database to gather data.
I have roughly 6 sheets in this workbook that contain my final data.
I would like to move all of this data to a PowerPoint presentation. I have seen many examples of how to move charts and graphs, but I have none of these in my workbook nor do I need them.
3 of my sheets display data generated by a pivot table on a separate sheet. I have done this because I am trying to avoid showing the pivot filter arrows.
The other three sheets are a table created from the Oracle query. Each sheet has a separate query to display data specific to a certain customer.
I would like to take the data I have in my spreadsheets and build tables in PowerPoint containing that data. I have tried importing the objects to PowerPoint, but since the data can change from minute to minute having to update the links and then refresh the data is rather clumsy. Also, I never know how many rows of data I will have. This is also due to the fact that the data can change minute by minute.
In short I am trying to look at Sheet one. Take all of the data there and build a table in PowerPoint to match. When building the table in PowerPoint only place a max number of 6 rows per PowerPoint slide. Continue to add slides until all of the data is moved.
You'll probably need to cobble together bits of the following that my friends Brian and Naresh have allowed my to post on the PowerPoint FAQ site I maintain, but between the two, it should get you there:
Controlling Office Applications from PowerPoint (by Naresh Nichani and Brian Reilly)
http://www.pptfaq.com/FAQ00795_Controlling_Office_Applications_from_PowerPoint_-by_Naresh_Nichani_and_Brian_Reilly-.htm
Where it starts: the DisplayData project by Naresh Nichani and Brian Reilly
http://www.pptfaq.com/FAQ00784_Where_it_starts-_the_DisplayData_project_by_Naresh_Nichani_and_Brian_Reilly.htm

generate a chart/graph in application using vb.net using excel worksheet data

How to generate a chart/graph in an application using vb.net using excel worksheet data?
I have a listview function that is already linking up the excel data and now wish to select certain data and create a line graph showing the results.
In listview I have each of the headings linked as a string.
Can a connection be made with either the ListViewItem or with the original Excel Worksheet. I want the graph to show on the general application form that has been created and not in an active Excel sheet.
Any help would be appreciated! :)
You should be ale to just databind whatever data you want in the listview with the chart. Can you give more details on how you want to select the data?
This shows Databinding (just pass in two arrays): http://msdn.microsoft.com/en-us/library/dd455475(v=vs.110).aspx
You could have two comboBoxes with the name of the potential x-values and the name of the potential y-values, and update the chart whenever one of the selected items changes.