powerquery

Index by category in Power BI equivalent to SQL row_number over partition

て烟熏妆下的殇ゞ 提交于 2019-11-30 09:33:50
问题 How to add index by category in M of Power BI with sorting by column. I look for equivalent of SQL: ROW_NUMBER() over(partition by [Category] order by [Date] desc Suppose we have a table: +----------+-------+------------+ | Category | Value | Date | +----------+-------+------------+ | apples | 3 | 2018-07-01 | | apples | 2 | 2018-07-02 | | apples | 1 | 2018-07-03 | | bananas | 9 | 2018-07-01 | | bananas | 8 | 2018-07-02 | | bananas | 7 | 2018-07-03 | +----------+-------+------------+ Desired

Json to excel using power query

蹲街弑〆低调 提交于 2019-11-30 04:47:45
I have some json on a website that i want to convert to excel using the power query option from web . But I ran into a small problem. My json looks like this: [ { "id" : 1, "visitors" : 26, "some_number" : 1, "value" : 3500 }, { "id" : 2, "visitors" : 21, "some_number" : 5, "value" : 2000 } ] but when i use from web i get this: I can drill down into a record,convert it to a table, transpose and use first row as header but then i get just one row. How can i get all of my data to the table and not just one row? First I would use the List Tools / Transform menu (it should be automatically

How can I get a column value from previous row in Power Query?

人盡茶涼 提交于 2019-11-30 00:01:52
问题 I want to get a value from the previous row. I tried the following code as suggested in this post: Table.AddColumn(#"Added index", "custom column", each {[Index]-1}[column name]) But it throws this error: Cannot use field access fot type List Please help, what am I doing wrong? 回答1: The error comes because {[Index]-1} without anything before it is a list value, but instead you want to index into a row of a table with this syntax: MyTable{index} That looks like: = Table.AddColumn(#"Added index

Index by category in Power BI equivalent to SQL row_number over partition

南笙酒味 提交于 2019-11-29 16:35:59
How to add index by category in M of Power BI with sorting by column. I look for equivalent of SQL: ROW_NUMBER() over(partition by [Category] order by [Date] desc Suppose we have a table: +----------+-------+------------+ | Category | Value | Date | +----------+-------+------------+ | apples | 3 | 2018-07-01 | | apples | 2 | 2018-07-02 | | apples | 1 | 2018-07-03 | | bananas | 9 | 2018-07-01 | | bananas | 8 | 2018-07-02 | | bananas | 7 | 2018-07-03 | +----------+-------+------------+ Desired results are: +----------+-------+------------+-------------------+ | Category | Value | Date | Index by

Combining different fees columns to create PivotTable income statement? [duplicate]

别等时光非礼了梦想. 提交于 2019-11-29 13:09:19
This question already has an answer here: Convert matrix to 3-column table ('reverse pivot', 'unpivot', 'flatten', 'normalize') 3 answers I have a table which records revenue for each product, split into type of revenue: price, fees, tax etc. To analyze the data I'd like to build a PivotTable to show the revenue breakdown, e.g.: So to build this PivotTable I need to somehow create an intermediate table of the following format so the PivotTable can be used: My question is, how do I create a PivotTable from the original table automatically without manually constructing the second table? Here are

Power Query Transform a Column based on Another Column

て烟熏妆下的殇ゞ 提交于 2019-11-29 04:43:25
I keep thinking this should be easy but the answer is evading me. In Excel Power Query, I would like to transform the value in each row of a column based on another column's value. For example, assume I have Table1 as follows: Column A | Column B ------------------- X | 1 Y | 2 I would like to transform the values in Column A based on the values in Column B, without having to add a new column and replace the original Column A. I have tried using TransformColumns but the input can only be the target column's value - I can't access other field values in the row/record from within the

Combining different fees columns to create PivotTable income statement? [duplicate]

情到浓时终转凉″ 提交于 2019-11-28 06:44:48
问题 This question already has answers here : Convert matrix to 3-column table ('reverse pivot', 'unpivot', 'flatten', 'normalize') (3 answers) Closed last year . I have a table which records revenue for each product, split into type of revenue: price, fees, tax etc. To analyze the data I'd like to build a PivotTable to show the revenue breakdown, e.g.: So to build this PivotTable I need to somehow create an intermediate table of the following format so the PivotTable can be used: My question is,

How to check whether Connection Refresh was successful

荒凉一梦 提交于 2019-11-28 00:35:14
In Excel 2016 VBA, I'm refreshing several queries like this: MyWorkbook.Connections(MyConnectionName).Refresh After the code is done, and no errors are encountered, I see that the hourglass icons for most of the queries are still spinning for several seconds. Is it possible to check for success AFTER all the refreshes are completed? I'm concerned that my code isn't going to know if an error happens after the code finishes but before the queries are done refreshing. BTW I don't want to do a RefreshAll, because some of the queries are dependent on others (uses them as a source). I refresh them

Power Query Transform a Column based on Another Column

北慕城南 提交于 2019-11-27 18:34:39
问题 I keep thinking this should be easy but the answer is evading me. In Excel Power Query, I would like to transform the value in each row of a column based on another column's value. For example, assume I have Table1 as follows: Column A | Column B ------------------- X | 1 Y | 2 I would like to transform the values in Column A based on the values in Column B, without having to add a new column and replace the original Column A. I have tried using TransformColumns but the input can only be the

PowerQuery: How can I concatenate grouped values?

帅比萌擦擦* 提交于 2019-11-27 03:41:05
If I have the following table (shown in the image below), how can I write a grouped query that would concatenate the grouped results? For this example, I'd want to group by the LetterColumn and concatenate the NumberColumn So the desired results would be: If your table is Source, and if NumberColumn has the number type, then this will work: = Table.Group(Source, {"LetterColumn"}, {{"Column", each Text.Combine(List.Transform(_[NumberColumn], (x) => Number.ToText(x)), ","), type text}}) Table.Group does a group by operation, which creates a table made up of all of the rows with the same value in