I'm using excel to get data from an external SQL server table, using power query, in the query window it shows date/time fields normally, but in the excel sheet, it shows it as a number, even when I change the type and cast and make a refresh it transform it again as a number.
Related
I got an excel file which should use a query from an ms access file (which is a front end for a ms sql server)
But instead of receiving every entry I want to use a filter by a value that is in one of the excel cells.
So if in A1 is date 01.01.2000, I want to use this value to only show me all entries by that date
If do not need to use power query if there is an easier way to do it.
You can pass a value into power query using a table and have your original query reference that cell/table. More detail here: https://exceleratorbi.com.au/pass-excel-parameter-power-query/
check the sample file, fill the parameters as per your DataBase
https://docs.google.com/spreadsheets/d/1nhB710FEl_AfFQy6HwDmR8xhcWWuw91p/edit?usp=sharing&ouid=100599386090580961037&rtpof=true&sd=true
I am trying to export some data to Excel via SQL-Server SSIS.
Everything works so far, but the data in Excel are not recognized as a date or decimal number, so that the user of the sheet first has to laboriously reformat.
Is there a way to export the data directly so that the correct format is recognized?
I select the data via OLE-DB-Source from a SQL-Server 2014 and than I do a data conversion to map the fields to the data formats of SSIS:
VARCHAR to DT_WSTR,
DECIMAL to DT_R8,
DATE to DT_DATE
Finally I use the excel-Export task to create a xlsx-File dynamically.
That works but I want that the data are in the format that the user of the Excel can directly filter and summarizing the data. That doesn't work.
i have a sheet where i connect to SQL. how can i create vba where every time i click refresh data connection query from power query, it will convert my text to number. Once it convert, i would like to format it to percentage and some are in accounting format. Upon refresh again, the same format will stick as it is without need to click format again. Is this possible?
Yes, it is possible, by using onChange event in VBA:
https://learn.microsoft.com/en-us/office/vba/api/excel.worksheet.change
Please note I have found solutions to this in Excel 2007, 2010, 2013 etc but nothing that relates directly to 2016.
I bring in a query to Excel by using Data / Get Data / From Database / From SQL Server Database.
What I want to do is restrict 1 column in the data it retrieves to a specific value.
In my exact example there is a date column and I want a cell in the spreadsheet to pass the date value to filter the returned query data.
For this application, I don't think you need to actually pass the date as a parameter to your query. You can just use the date from the cell as a filter after you've loaded your query into the Query Editor. As a result of query folding, Excel should automatically pass it into the WHERE clause of the native query it sends to the SQL Server Database.
If you don't know how to reference a cell value in the Query Editor, please see this question:
How can I reference a cell's value in a Power Query
I have a DIM Date dimension in my cube that has a date column whose type in SQL datamart is "date" and the data type in cube for this arribute is set to "date". But when I query the cube from excel and tableau, this arribute shows up as string instead of date and so I don't get the natural hierarchy of year ->month -> date in the client tools. Both excel and tableau format this column correctly if I connect directly to datamart instead of a cube.
Is there any trick or tip to make these client tools format the date column as datetime instead of string ?
I don't want to manually create these hierarchies in the cubes because there are 60+ date columns in my cube across all dimensions
Thanks
In Tableau, you can change the field type to date and then save the data source as a reusable tds file. The settings should then be retained
From http://www.theinformationlab.co.uk/2013/12/02/tableau-file-types-and-extensions/ :
Tableau Datasource (.tds)
When you connect to your data for the fist time, you may have a little bit of data ‘modelling’ to do – setting the right data types, changing default aggregations, setting default colours, creating some custom calculated fields etc etc. You are giving Tableau information about the data you will be using – you are setting up its ‘metadata’. When you want to connect to this data again, you don’t want to really go through all this data modelling a second time so instead you can save your metadata as a .tds file (again, it is saved in XML format) and connect to your data though this file instead. You could also distribute this file so that your colleagues have access to the nice formatting and custom fields you have worked to set up.
Tableau is clever enough to pick up new columns/fields in the data source if they appear and column ordering does not matter but if column names change or disappear completely, you will need to reconfigure.
To create a .tds file, from Tableau Desktop, right click on your data source connection and select Add to Saved Data Sources. Alternatively you can publish the .tds to Tableau Server by right clicking and selecting Publish to Server instead