m

How to show data properly in Office Excel Using Power Query Editor?

戏子无情 提交于 2020-12-26 06:56:22
问题 I have below JSON output from an API, in Office Excel I am importing data via Web from API. [{ "level": 1, "children": [{ "level": 2, "children": [{ "level": 3, "name": "Chandni Chowk", "data": ["Data 1", "Data 2"] }], "name": "Delhi", "data": ["Delhi Area"] }], "name": "Country", "data": ["India", "Bangladesh"] }] https://docs.microsoft.com/en-us/powerquery-m/quick-tour-of-the-power-query-m-formula-language I have above document. let Source = Json.Document(Web.Contents("MY API URL GOES HERE"

PowerQuery - Fill missing data according to specific pattern

ⅰ亾dé卋堺 提交于 2020-12-15 06:08:25
问题 I am trying to clean data received from an Excel file and transform it using PowerQuery (in PowerBI) into a useable format. Below a sample table, and what I am trying to do: | Country | Type of location | |--------- |------------------ | | A | 1 | | | 2 | | | 3 | | B | 1 | | | 2 | | | 3 | | C | 1 | | | 2 | | | 3 | As you can see, I have a list of location types for each country (always constant, always the same number per country, ie each country has 3 rows for 3 location types) What I am

Add Index without unique values - Power BI / DAX / M

大憨熊 提交于 2020-12-15 05:03:40
问题 I have a column with Countries (in a table, the column have duplicates) and I need to order them with a index: Countries, Desirable index A 1 B 2 B 2 C 3 D 4 D 4 E 5 I can't remove the duplicates because I need the other columns for reference thanks 回答1: Create a table of only distinct countries, index that table, then merge/join that table back to your existing table (the one with duplicates) and expand the index column you just created. 来源: https://stackoverflow.com/questions/65145128/add

How to join two tables in PowerQuery with one of many columns matching?

拈花ヽ惹草 提交于 2020-12-11 05:03:57
问题 Let's assume we have two PowerQuery queries: a query named Query1 with columns Col1_1 and Col1_2 a query named Query2 with columns Col2_1 and Col2_2 I know it's possible to join these two queries with a merge query like this: let Source = Table.NestedJoin(Query1,{"Col1_1", "Col1_2"},Query2,{"Col2_1", "Col2_2"},"Query2",JoinKind.LeftOuter) in Source In SQL, this could be represented as SELECT * FROM Query1 LEFT JOIN Query2 ON Query1.Col1_1 = Query2.Col2_1 AND Query1.Col1_2 = Query2.Col2_2

Is there any way to invoke PowerQuery/M outside of Excel or PowerBI?

扶醉桌前 提交于 2020-08-02 06:08:49
问题 Our BI team is really growing to like the Power Query ETL tool used within Excel and Power BI. The functional language M/PowerQuery has great utility and it would be nice to be able to utilize outside of the context of PowerBI. Is there or are there plans for exposing "M" as a stand-alone module, callable form the likes of c# or PowerShell? 回答1: It appears that this is now possible via the Power Query SDK. This has enabled projects such as PowerQueryNet, which can already execute the M

How to merge queries in power bi with 2 primary keys

你说的曾经没有我的故事 提交于 2020-06-28 05:07:42
问题 How do we merge two queries in power bi when the primary key is a combination of 2 columns. for example i have 2 tables Table A : year cost center col a col b col c Table B: year cost center col x col y col z The primary key in both the columns is a combination of the 1st two columns. How do i merge these two queries? 回答1: When you merge the queries using the GUI, you can hold down Ctrl to select multiple columns from each table. (Make sure you select them in the same order on both tables.)

Passing a “list” to a function call with the 'each' keyword

Deadly 提交于 2020-06-27 13:20:13
问题 First things first, I will confess I am not an M or Power Query expert, though I do have some experience with Power BI. I am trying to develop a stock portfolio that will track a customised list of stocks with their price history and other metrics. Part of my code is based on the following blog, due to the problem I am trying to solve: https://datachant.com/2016/08/09/sentiment-analysis-power-bi-part-2/ I have the following function getPriceMetrics in my project that will take one parameter

Bridge tables - DAX or M?

送分小仙女□ 提交于 2020-05-15 06:37:05
问题 Should we construct bridge tables with DAX or M? Picture stolen from here It seems very tempting to use DAX. With DAX the code is short and clear: IDList = DISTINCT( UNION( DISTINCT(Table1[ID]) ,DISTINCT(Table2[ID]) )) Moreover, DAX tables do not need to be loaded as M tables. However I wonder if advantage of DAX over M is not illusory? M seems to load once and DAX seems to be calculated on the fly, maybe anytime, over and over? 回答1: DAX calculated tables are re-calculated if any of the

Power Query: how to add one to a column when a specific values appear in an other column

蓝咒 提交于 2020-05-08 14:25:48
问题 I have an ID column and I am looking for ways to increment my IDs each time a specific item appears in my Geography column ( ItalyZ , ItalyM , UKY or UKM ) is found. The ID of ItalyZ starts at 0 and ends at 4000. The ID of ItalyB starts at 4000 and ends at 8000. The ID of UKY starts at 0 and ends at 4000. The ID of UKM starts at 4000 and ends at 8000. However, I am refreshing my file, and I will thus have from time to time new arrivals of "geographies" without the origins or first IDs. These

How can I loop trough elements in columns in a powerbi function?

大憨熊 提交于 2020-04-30 10:24:23
问题 I want to write a Function for cleaning numbers. While leaving them as text. So, in my queries I want to use e.g.: = CleanRN(PrevQueryTable, {"NumericTextColumn"}) The function is supposed to remove all non numeric characters and leading zeroes in not already numeric texts. (But the function is not the point for this question.) So in the queries themselves I can go with = Table.ReplaceValue(Benutzerdefiniert2,"_","",Replacer.ReplaceText,{"ONKZ/RufNr"}) or = Table.ReplaceValue(#"Ersetzter