m

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

本小妞迷上赌 提交于 2019-11-30 17:07:31
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? 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", "custom column", each #"Added index"{[Index]-1}[My Column]) 来源: https://stackoverflow.com/questions

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

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

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,

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

How can I reference a cell's value in PowerQuery

萝らか妹 提交于 2019-11-26 18:50:53
I'm having multiple PowerQuery queries that I would like to feed the value of a cell in my Excel file. In this particular case, the full path to the sourcefile name. Is there any way I can get this into PowerQuery? Peter Albert This can be achieved using a named range and a custom function in PowerQuery: Name the cell you need to refer (type in a name into the file left of the formula bar) - e.g. SourceFile Insert a new blank PowerQuery query (PowerQuery ribbon -> From other sources) In the PowerQuery editor, go to View -> Advanced Editor and paste the following code; (rangeName) => Excel

PowerQuery: How can I concatenate grouped values?

天大地大妈咪最大 提交于 2019-11-26 09:29:32
问题 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: 回答1: 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}})

How can I reference a cell's value in PowerQuery

假装没事ソ 提交于 2019-11-26 05:30:00
问题 I\'m having multiple PowerQuery queries that I would like to feed the value of a cell in my Excel file. In this particular case, the full path to the sourcefile name. Is there any way I can get this into PowerQuery? 回答1: This can be achieved using a named range and a custom function in PowerQuery: Name the cell you need to refer (type in a name into the file left of the formula bar) - e.g. SourceFile Insert a new blank PowerQuery query (PowerQuery ribbon -> From other sources) In the