powerquery

Auto-updating Power Query Connection via VBA

社会主义新天地 提交于 2020-01-01 05:14:12
问题 I have a Power Query set in myexcel.xlsx. I set its connections's properties as this and this. I wrote a VBA code like the following Sub UpdateData() Dim filename As String Dim wbResults As Workbook filename = "C:\myexcel.xlsx" Set wbResults = Workbooks.Open(filename) ActiveWorkbook.RefreshAll wbResults.Close savechanges:=True End Sub When I open the myexcel.xslx manually, the Power Query connection updates. But through VBA code it doesn't. I should add I tested this with an old fashioned

Select row with MAX value per category Power BI

天涯浪子 提交于 2019-12-30 20:01:17
问题 How to select row with max value per category in M of Power BI. Suppose we have table: +----------+-------+------------+ | Category | Value | Date | +----------+-------+------------+ | apples | 1 | 2018-07-01 | | apples | 2 | 2018-07-02 | | apples | 3 | 2018-07-03 | | bananas | 7 | 2018-07-04 | | bananas | 8 | 2018-07-05 | | bananas | 9 | 2018-07-06 | +----------+-------+------------+ Desired results are: +----------+-------+------------+ | Category | Value | Date | +----------+-------+------

Export Power Queries from One Workbook to Another with VBA

▼魔方 西西 提交于 2019-12-25 18:56:15
问题 I am looking to transfer power queries from one workbook to another with VBA. I know how to do this manually but it is very cumbersome. A power query can be accessed via the Workbook.Connections object. I am currently attempting to port the queries over with a VBA function or Sub. The manual process is as follows for each query in workbook 1 open up workbook 1 and go to advanced editor - copy into a text editor open up workbook 2 create query, and paste text into advanced editor ensure source

Nest Load a folder path Power Query

爷,独闯天下 提交于 2019-12-25 09:34:51
问题 I'm trying to use Excel Power Query (Stuck with Excel 2010 in this one) to check if a folder called "SWPPP", which is inside a list of directories, has files in it. The folder structure is as follows. |O:\Planning Projects |---2012\ |--------00-000 A Custom Folder Name\ |------------------------------------\SWPPP |---2013\ |--------00-000 A Custom Folder Name\ |------------------------------------\SWPPP |---2014\ |--------00-000 A Custom Folder Name\ |------------------------------------

How to Change Excel Power Query Paramaters with VBA

心已入冬 提交于 2019-12-25 03:36:14
问题 How to change Excel PowerQuery Paramaters with VBA? i.e. These Paramaters: Right now the Paramater has a value of 8, and is used in refreshing all other power queries. How can I change this paramater with VBA? The Macro recorder does not show anything. 回答1: Thanks to QHarr, I figured it out. Simply edit the Power Query M Code - the Parameter value is first item in the Code. e.g. 5 meta [IsParameterQuery=true, Type="Number", IsParameterQueryRequired=true] 5 is the Parameter Value. To edit, use

How to access Clockify API through Power Query

大城市里の小女人 提交于 2019-12-25 01:08:50
问题 I am trying to get my time entries from Clockify API directly via Power Query to Excel. I use the following code in the Power Query: = Web.Contents("https://api.clockify.me/api/workspaces/ID of my workspace/timeEntries/", [ Query=[ #"filter"="", #"orderBy"=""], ApiKeyName="APIToken" ]) When I then try to run the code I am prompted to enter the Web API authentification, which delivers an error ("English translation: Authentification does not work. Try again") after I enter my correct Web API

EXCEL How to change the REST URL based on the cell parameters

会有一股神秘感。 提交于 2019-12-25 01:08:02
问题 I created a web query as below in Excel. New Queries --> From Other Sources --> From Web How do I pass in the cell value as a parameter to the Url? I have search bunch of articles, including in the stackoverflow. None of them work. There is 1 article says I can do this in VBA. ThisWorkbook.Sheets("[SheetName]").QueryTables("[TableName]").Connection = But it is not there. Any one know how to do this? More information: It is connecting to a REST server, and geting back the JSON result. I found

How to calculate conditional running total in power query (Excel 2016)?

不羁的心 提交于 2019-12-25 00:27:01
问题 Is it possible to calculate conditional based running total in power query? I need to add numbers(cumulative sum) based on the group. See the image attached. Currently I'm using a formula to calculate that in sheet and loading it to query editor. Is there any other logic to achieve that in power query (if possible, without indexing : because index took too much time to load). 来源: https://stackoverflow.com/questions/49442192/how-to-calculate-conditional-running-total-in-power-query-excel-2016

Power Query Child hierarcy

不想你离开。 提交于 2019-12-24 23:45:01
问题 I have a problem I need to solve in power query. I have table containing columns Name, ID and Parent ID Name ID Parent A 1 B 2 1 C 3 1 D 4 2 E 5 2 I need to transform this table so that I get one row for each child (and orginal) that row has. In this example this would yield 11 rows. Name ID A 1 A 2 A 3 A 4 A 5 B 2 B 4 B 5 C 3 etc. I know this is done with some sort of joining but it feels like a loop and I don't know how to do loops in Power Query. 回答1: A friendly reddit user created

Value column counts or Summarizes even if I checked “Dont Summarize” Power BI Desktop

一世执手 提交于 2019-12-24 18:44:55
问题 The goal is to create a visual that shows Budget vs Premium for each month in a year; Something like that: I established relationship between Premiums table and Divisions table. It didnt give me any error, so I'm assuming everything is fine. On a chart I need SUM of premium but NOT SUM of Budget. But when I put Budget on a column chart it summarizes it. I checked "Do not summarize" but it still, either summarize either count value. Premium value summarized which is fine, that is what I need.