m

How can I expand all lists in a row of lists at the same time without repeating values?

你离开我真会死。 提交于 2019-12-23 05:32:29
问题 In response to this question regarding how to expand all lists in a row of lists at the same time, @Carl Walsh kindly provided this succinct and helpful code: let Source = #table({"A", "B"}, {{ {1,2}, {3,4}} }), Expanded = List.Accumulate( Table.ColumnNames(Source), Source, (state, column) => Table.ExpandListColumn(state, column)) in Expanded Which yields this: I would like to get this result instead: I don't want values repeated in previously processed columns as each follow-on column is

How to get paginated data from API in Power BI

北战南征 提交于 2019-12-21 05:41:15
问题 Let's say we have this endpoint https://reqres.in/api/users . The response is { "page": 1, "per_page": 3, "total": 12, "total_pages": 4, "data": [ { "id": 1, "first_name": "George", "last_name": "Bluth", "avatar": "https://s3.amazonaws.com/uifaces/faces/twitter/calebogden/128.jpg" }, { "id": 2, "first_name": "Janet", "last_name": "Weaver", "avatar": "https://s3.amazonaws.com/uifaces/faces/twitter/josephstein/128.jpg" }, { "id": 3, "first_name": "Emma", "last_name": "Wong", "avatar": "https:/

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

和自甴很熟 提交于 2019-12-20 04:34:12
问题 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(

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

拈花ヽ惹草 提交于 2019-12-19 04:02:02
问题 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"

Add Special Case to Power BI Query (M)

拥有回忆 提交于 2019-12-14 02:13:24
问题 I'm currently using Power BI's query editor to unpivot, transform, join, re-pivot and re-join some data. Illustrating: REF_Capability: ID#| Capability.1 | Capability.2 | Capability.3| 97 | Crawl | Walk | Run | 98 | Crawl | null | null | 99 | Crawl | Walk | null | Table2: Capability | Attribute| Value | Crawl | Vehicle1 | 4 | Walk | Vehicle1 | 3 | Run | Vehicle1 | 2 | Crawl | Vehicle2 | 0 | Walk | Vehicle2 | 1 | Run | Vehilce2 | 1 | Crawl | Vehicle3 | 0 | Walk | Vehicle3 | 5 | Run | Vehicle3 |

How can I expand all lists in a row of lists at the same time?

安稳与你 提交于 2019-12-13 18:20:57
问题 I would like to expand all of the lists in this table at once without having to explicitly name (hard-code) each column . I do want to assume that all columns have a list in the row. I also want to be able to apply the solution to a table with less or more columns than are in the example. The table might decrease or increase its number of columns and the columns' names might change, which is why I don't want to use explicit column names. I've found a few threads about expanding multiple lists

extract and replace parameters in SQL query using M-language

穿精又带淫゛_ 提交于 2019-12-13 03:21:26
问题 This question is related with this question. However, in that question I made some wrong assumptions... I have a string that contains a SQL query, with or without one or more parameters, where each parameter has a "&" (ampersand sign) as prefix. Now I want to extract all parameters, load them into a table in excel where the user can enter the values for each parameter. Then I need to use these values as a replacement for the variables in the SQL query so I can run the query... The problem I

Visualizing last refresh date in power bi

。_饼干妹妹 提交于 2019-12-12 14:28:08
问题 Is it possible to add a card in power BI that shows the last time the underneath dataset has been updated? Many thanks! 回答1: You can create a blank query and use the following M query to create a single-cell table: let Source = #table(type table[Last Refresh=datetime], {{DateTime.LocalNow()}}) in Source And then you can use the Card visual and drag in the column to show it. You can rename the field to remove the default aggregation. (It doesn't matter since there is only one row of data

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

坚强是说给别人听的谎言 提交于 2019-12-12 08:16:48
问题 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:

Why does a reference to a value in previous row throw this Expression.Error?

为君一笑 提交于 2019-12-12 06:47:28
问题 I am trying to perform an operation in Excel using Powerquery. I want to remove contacts in a list if they are connected to a certain CompanyID but are listed with a different CompanyName. The fist step is to filter them out by comparing to the row above. They are always listed consecutively. Next step is to remove all rows containing the value delete in the delete column but unfortunately I do not get to that step. I have looked at this post and have tried with the following code: = Table