m

Add missing date rows in Power BI/Power Query and take value of row above

落爺英雄遲暮 提交于 2019-12-03 21:39:36
Say I am importing something like the following into PowerBI: Date | Quantity |---------------------|------------------| | 1/1/2018 | 22 | | 1/3/2018 | 30 | | 1/4/2018 | 10 | |---------------------|------------------| Where the external source table is a series of date, value rows with some date values missing. I'd like to execute some DAX/M to add any missing date rows into the data set, where 'Quantity' value is taken from the first date prior. So my resulting dataset would like like this: Date | Quantity |---------------------|------------------| | 1/1/2018 | 22 | | 1/2/2018 | 22 | | 1/3

What's the difference between DAX and Power Query (or M)?

非 Y 不嫁゛ 提交于 2019-12-03 04:13:51
问题 I have been working on Power BI for a while now and I often get confused when I browse through help topics of it. They often refer to the functions and formulas being used as DAX functions or Power Query, but I am unable to tell the difference between these two. Please guide me. 回答1: M and DAX are two completely different languages. M is used in Power Query (a.k.a. Get & Transform in Excel 2016) and the query tool for Power BI Desktop. Its functions and syntax are very different from Excel

What's the difference between DAX and Power Query (or M)?

吃可爱长大的小学妹 提交于 2019-12-02 17:30:34
I have been working on Power BI for a while now and I often get confused when I browse through help topics of it. They often refer to the functions and formulas being used as DAX functions or Power Query, but I am unable to tell the difference between these two. Please guide me. M and DAX are two completely different languages. M is used in Power Query (a.k.a. Get & Transform in Excel 2016) and the query tool for Power BI Desktop. Its functions and syntax are very different from Excel worksheet functions. M is a mashup query language used to query a multitude of data sources. It contains

Power Query - Data Transformation from a single column to a whole table

落爺英雄遲暮 提交于 2019-12-02 07:07:52
问题 I have a requirement where I have a table like this - Actual Table with 2 columns Column1 Column2 ColAValue $$ ColBValue $$ New Row ColCValue Above Row ColCValue2 Above Row $$ ColDValue Above Row ColAValue $$ ColBValue $$ ColCValue $$ ColDValue New Row ColAValue $$ ColBValue $$ ColCValue New Row $$ ColDValue Above Row I know by requirement, I would have 4 columns in my dataset leaving column 2 . I need my transformed table as a new table using query editor. This is my expected output,

Power Query - Data Transformation from a single column to a whole table

核能气质少年 提交于 2019-12-02 06:09:51
I have a requirement where I have a table like this - Actual Table with 2 columns Column1 Column2 ColAValue $$ ColBValue $$ New Row ColCValue Above Row ColCValue2 Above Row $$ ColDValue Above Row ColAValue $$ ColBValue $$ ColCValue $$ ColDValue New Row ColAValue $$ ColBValue $$ ColCValue New Row $$ ColDValue Above Row I know by requirement, I would have 4 columns in my dataset leaving column 2 . I need my transformed table as a new table using query editor. This is my expected output, OutTable with 4 columns Basically the column values are identified in order by delimiter $$ and if column2

replace multiple words in string with specific words from list

∥☆過路亽.° 提交于 2019-12-02 04:25:37
问题 How can I, using M-language, replace specific words in a string with other specific words that are specified in a table? See my example data: Source code: let someTable = Table.FromColumns({{"aa &bb &cc dd","&ee ff &gg hh &ii"}, {Table.FromColumns({{"&bb","&cc"}, {"ReplacementForbb", "ccReplacement"}},{"StringToFind", "ReplaceWith"}), Table.FromColumns({{"&ee", "&gg","&ii"}, {"OtherReplacementForee", "SomeReplacementForgg", "Replacingii"}},{"StringToFind", "ReplaceWith"})}, {"aa

Add column of previous values from table of tables in Power BI / Power Query

我的未来我决定 提交于 2019-12-02 04:23:44
Looking for a followup to Max Zelensky's solution here . Assuming the original example had a [Date] field, I'm trying to go one more level and add a column that shows the prior [Date] value I've also looked here and here and here . Per Max, I've created the table of tables: AddedCustom = Table.AddColumn(GroupedRows, "Custom", each Table.AddIndexColumn([tmp],"Occurrence", 1,1) type table) Created a second index: SecondIndex= Table.AddColumn(AddedCustom, "Custom.2", each Table.AddIndexColumn([Custom],"Occurance.2", 0,1), type table) I've successfully added a column that references the current

Select row with MAX value per category Power BI

女生的网名这么多〃 提交于 2019-12-01 21:34:35
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 | +----------+-------+------------+ | apples | 3 | 2018-07-03 | | bananas | 9 | 2018-07-06 | +----------+-------+------------+ Here

Dynamically expand ALL lists and records from json

我的梦境 提交于 2019-12-01 08:57:30
问题 I want to expand all lists and records in a json response. Columns are like e.g. (this is dynamically, it also can be 10 records and 5 lists): Text, Text, [List], [List], Text, [Record], [Record], String, [Record] I wrote a function for getting all columns with the specific type Cn.GetAllColumnsWithType = (table as table, typ as type) as list => let ColumnNames = Table.ColumnNames(table), ColumnsOfType = List.Select(ColumnNames, (name) => List.AllTrue(List.Transform(Table.Column(table, name),

How can I turn the deepest elements of nested JSON payload into individual rows in Power Query?

≯℡__Kan透↙ 提交于 2019-11-30 23:47:05
Goal : I have a JSON payload with the following format: { "Values": [ { "Details": { "14342": { "2016-06-07T00:00:00": { "Value": 99.62, "Count": 7186 }, "2016-06-08T00:00:00": { "Value": 99.73, "Count": 7492 } }, "14362": { "2016-06-07T00:00:00": { "Value": 97.55, "Count": 1879 }, "2016-06-08T00:00:00": { "Value": 92.68, "Count": 355 } } }, "Key": "query5570027", "Total": 0.0 }, { "Details": { "14342": { "2016-06-07T00:00:00": { "Value": 0.0, "Count": 1018 }, "2016-06-08T00:00:00": { "Value": 0.0, "Count": 1227 } } }, "Key": "query4004194", "Total": 0.0 } ], "LatencyInMinute": 0.0 } I want to