Is it possible to get to source of pivot table through Power BI? - pivot-table

Is it possible to get to source of pivot table through Power BI?
We have pivot table in Excel file connected to external source.
We do not have access to the external source.
If we double click on the sum of sums in pivot table, we can show details of all data that the pivot table is built on.
We would like to connect from Power BI to that detailed data on which the pivot is built on directly without intermediate step of clicking on sum of sums and saving the file. Is it possible, and if so, how?

You can try to copy the source directly from the Advance Editor in Power Query then in Power BI create a Blank Query where you can paste the lines.

Related

load into Fact Table

i have four dimension tables (titles,publishers,stores,period) and i like to load data into a fact table but i didn't know how! by the way i'm using SSIS
and in the measures of this fact table i have Qty and turnover(chiffre d'affaire) that i need to calculate but i din't know how to. plus in my source data i have in every date a qty.
i want to know which ssis tools i need to use to achieve that + calculating the measures.
i calculate qte from sources but it don't give me to every row a qte. it gives me qte of all in one row!!
Your question is very basic, so I suggest you to take your time and look at some SSIS tutorials on youtube or:
https://learn.microsoft.com/en-us/sql/integration-services/lesson-1-create-a-project-and-basic-package-with-ssis
To answer your question though: you need to first add a Data Flow Task into your Control Flow. Double click on the DFT and in the Data Flow, add an Excel Source to connect to your source. If you want to do some calculations, you need to use a Derived Column transformation.

Import multiple Excel files to create 1 table in SQL Server 2012

I have a few experience in using SQL Server 2012.
All I know to import a excel to database is like the following:
open SQL Server Management Studio
right click on the "table" folder -> Tasks -> Import Data
set data source to MS Excel.
It seems that only one Excel is entertained.
But I want to concatenate 6 Excel files (all with same column layouts) to form a single table in SQL Server.
P.S. No need to tell me to concatenate the Excel file manually by copy and paste because each individual Excel file has about ~50,000 records.
Any ideas / solutions by using sql scripts or any other programming methods?
Thanks a lot.
There's a range of ways to do this, but I'll give you the simplest that comes to mind without requiring any deep technical knowledge on your part.
Given that you're using the wizard, firstly on the 'Select Table Sources and Views' page, change the 'Destination' to be the name of the table you've previously created.
Then, under the 'Edit Mappings' menu when selecting your sheets, ensure you have 'Append rows to the destination table' selected, rather than Create/Delete. Within reason, this will achieve your goal.
There is a risk in flat file loading like this that SQL Server will create your table with unsuitable types (i.e. a Column is a text column, but only contained numbers on the first file - so the column was created as an INT and wont accept any other files). You'll need to create the tables from scratch again with the right structure or work with the mappings page to do this work.
Another way for the semi-technical type is as long as the data is equivelent between files, you can simply do your imports into a series of seperate tables:
Table1
Table2
Table3
...
Then do a
INSERT INTO Table1
SELECT * FROM Table2
UNION ALL
SELECT * FROM Table3
... Add tables here
You can then use DROP TABLE to remove the extras.

Migrate Excel Data to SQL

I have a large table of information (around 11,000 rows, 4 columns) in Excel that uses a macro and I need to import it to an SQL server, Microsoft SQL Server Management Studio, which will be utilized by another server to get the new information.
Example:
If I type into SQL:
Insert Into ENT_LINK_OBJECTS (OBJ_NAME, ENTITY_KEY, IDENTITY_KEY)
Select 'TDS-C1487-81236', ITEM_KEY, 1
From ENT_ITEM_MASTER As M
Where M.ITEM_CODE = 'TL-123'
or M.ITEM_CODE = 'TL-456'
I can then open the program which holds all this information, called Matrix, which prompts me to enter an item key and/or code and/or type etc (which has all possible files listed below it) and hit search (image 1). If I type in TL-123 to the item code section (image 2), it narrows down the files to any containing TL-123 (image 3). When i double click, I can click on many tabs, one of which is "Links". In that tab under document name the information TDS-C1487-81236(image 4). How would I go about making that happen?
(1)
(2)
Then hit ENTER
(3)
(4)
The website below is a good explanation of what I am getting at but I do not know how to implement it. What would be the most efficient way to migrate the data from my excel document to the SQL server?
http://sqlmag.com/business-intelligence/excel-macro-creates-insert-statements-easy-data-migration
Have you tried DTSWizard ? Its a GUI based tool to do so.. and should be shipped with MS SQL server
Create a linked server or Use statement like OPENROWSET to access Excel Sheet. That would be the easiest and fastest method of accessing excel sheet via SQL.

Pivot or Unpivot a dataset using Excel, SSIS or SQL Server

I have an Excel file with various market indexes, dates, and values. In this file there is a single column to the left representing the market index names followed by many date columns to the right. I can perform this pivot in Excel, SSIS or SQL Server. I have the most recent versions of each program. I don't want to simply copy and paste special transpose in Excel. I would like the solution to be automated as possible. I suspect loading this data into SSMS and using SQL would be the easiest. I can change the format of the dates if needed.
I have used pivot in both SSIS and SSMS but always with less columns than this tasks requires and am not sure how to approach it in a way that will allow for the large amount of columns and potential for the number of columns (dates) to vary. Perhaps this requires dynamic SQL. The dates which comprise the bulk of the columns can potentially extend 100 rows or more. Note there may be null values if an index didn't have a value on a given day.
Input data
Here is the desired output format.
Here is the data loaded into SSMS 2012. The dates become the column headers. Same goal of transposing the dates and index names.
I would use the Excel Power Query Add-In for this. It has Pivot and Unpivot commands that you can use. The Power Query implementations of both commands are dynamic i.e. they adjust to variations in the input data.
For your scenario I would first select Name and Unpivot all other columns. That will transform each date column and value into a row. Then I would Pivot on the Name column, which will generate columns for each of your Name values.
To automate this process, you just need a few lines of VBA code or script code to open, refresh and save the Excel file (including Power Queries). There are lots of options for this, e.g.
http://southbaydba.com/2013/09/10/part-5-power-query-api-refreshing-data-indeed/

Linking MS Excel to MS Access queries

I have an Access database that I use to to run a bunch of aggregate TOP 5 queries. The end game of this particular function is ppt presentations with charts. So to automate this a bit, I created an excel spreadsheet with a bunch of pre-made charts in it. The I linked/data imported the query results into the excel spreadsheet, and set the cell ranges to match the source ranges for the charts. Finally I set the spreadsheet to enable auto refresh upon every "file open", and presto, I run the queries in access with a button press, then open the excel file, and the data refreshes, and they are my charts. I then use some VB to copy paste all active charts into ppt, but that is another matter.
Okay so here is the snag I hit. I needed to do the exact same procedure with another spreadsheet from another ag query. Before the process I was using was just clicking data > import external data > import data and then choosing the file of the database, and then it would populate a list of tables and queries to choose from. Only now, it will not show any queries in that populated list; only tables!?!
any ideas? btw MSO 2003
I can't reproduce that Justin. In the dialog that shows the tables, scroll over to the right and check the TYPE column. Queries will have a type of VIEW and tables of TABLE. Verify that they all say TABLE.
Next, try using Data - Import External Data - New Database Query instead of 'Import Data'. Select the Access driver and the Access mdb. This will bring up a different dialog, but should show both tables and queries. See if that shows only tables or shows both.
I presume this is a security feature that has been introduced?
Try selecting any table then select Data>Import External Data>Edit Query
Then select SQL as the command type and either enter the query SQL or just select from a query i.e.:
select * from qryCat;
Hope this helps
thanks Mark

Resources