I am having a "Measure" table in PowerBI desktop which I want to transpose it in Query Editor, I know how to do this if it is not a measure or calculated table, any ideas how to achieve it with measure table?
You can't go back with PowerPivot tables to PowerQuery. Your only option is to stay in PowerPivot and use DAX. Unfortunately there is no transpose function in DAX, so you basically have to construct your transposed table manually using the SELECTCOLUMNS() and FILTER() functions.
In the Packt library there is a recipe how to achieve that: Transposing tables
Depending on your data model it might be easier to create a transposed copy of your table in PQ before you start adding measures in PP.
Related
Is it possible to refer from Power Query (M) to DAX calculated table? I would like to get DAX table as a source to my power query.
The purpose. I have grouping table made in DAX. I would like to make econometric model with R. So I would like to transform the DAX table with R to get the model parameters. I would like to use these parameters further in DAX measures (not just display them).
Currently I dump the DAX grouping table to Excel file and then pull it up with Power Query.
Actually, there is a way.
DISCLAIMER: This is a hack. You should not rely on this way.
1. Create DAX calculated table
Input any DAX formula that evaluates to a table in Modeling > New Table.
2. Check port number using DAX Studio
Connect to your PBI Desktop data model using DAX Studio, and check the port number where the data model is hosted. It should be displayed in the right bottom of the window.
3. Import the table to Power Query
Click Get Data > Analysis Services and input the address (in my example "localhost:50293") to Server. Then navigate to your DAX calculated table.
it's not possible to refer to a DAX calculated table in M as it's loaded into DAX/Power Pivot engine after M has done the transformations. You can't write to a DAX table after loading into R as well. You can do grouping in M, or if needed run R in the Power Query. One approach that I have used has to load the data, duplicate the query, run a group/filter on the new query, then use that data in a later stage in the report.
Hope that helps
Jonee is correct. This is not possible. DAX calculated tables are computed after the M queries have loaded and you cannot feed them back into Power Query without saving them externally like you are currently doing.
The M language is more powerful than you might think and very likely could do the same grouping operations, though depending on what they are, it might be fairly difficult. You can also use R or Python script within an M query if you are more comfortable with those.
I want to move(denormalize)two tables into another tabe,how can I do it?
have two tables like:- 'sales by category','product by category',
I want to move these two tables into another table which is 'products'.
i tried Related function with calucated column and it won't work bcoz those tables sharing one-one relationship
plz solve my issue who are familiar with data modelling and dax in power bi
The best way is to use the merge function in power query, follow the tutorial on the below link it'll explain it better, this will allow you to join the tables you need into query, in turn creating a table in Power BI
https://learn.microsoft.com/en-us/power-bi/desktop-shape-and-combine-data#combine-queries
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?
DAX calculated tables are re-calculated if any of the tables it pulls data from are refreshed or updated in any way. (from https://learn.microsoft.com/en-us/power-bi/desktop-calculated-tables )
They're not re-calculated "on the fly", nor "over and over". There's no difference to the refresh cycle of your Power BI data model, between using a DAX calculated table or an M query table. You may however find that DAX calculated tables refresh faster than M, depending on the complexity of the table...
Considering M Tables, M Conditional Columns, M Custom Columns, DAX Tables, DAX Calculated Columns and DAX Measures. It is only the DAX Measures that gets created on the fly and is not a part of the data model.
So for a Simple Bridge Table, DAX Table and M Table have no real advantage over each other.
Both Tables allows one to create relationships. Now, When I say simple Bridge Table, it is something that is created from 2 or 3 tables and uses the same column to establish relationships with two or more tables.
But when the requirements become complex and agile (growing over time), the maintenance and the developments efforts also increases, if it is created by DAX. (my personal opinion and I think most people's personal opinion as well.)
If it is created by M, then it is more easy to add a new column or filter based on a logic or to replace an existing value.
Taking back to the Thumb Rule :- If it is created by DAX, then M Cannot be used on top of it to make changes. So, if the Bridge Table is created by DAX, then it won't appear in the query editor and limits the advantages of GUI to make any required simple transformations in the data.
For a Simple Bridge Table :- DAX.
But For a complex and changing requirement :- M.
In Power BI, I am creating a report with some finance data of a company. I have 3 different tables. The table structure of all three tables are as follows:
I want to change these tables into this structure:
Is it possible to achieve this kind of structure? If yes and please suggest some method to do this?
To do it simply you can import 3 times your table using the query editor, and then in one table keep only columns for Planned, in the second table keep columns for Actual, and so on...
Hope that helps!
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 commands to transform data and can return the results of the query and transformations to either an Excel table or the Excel or Power BI data model.
More information about M can be found here and using your favourite search engine.
DAX stands for Data Analysis eXpressions. DAX is the formula language used in Power Pivot and Power BI Desktop. DAX uses functions to work on data that is stored in tables. Some DAX functions are identical to Excel worksheet functions, but DAX has many more functions to summarize, slice and dice complex data scenarios.
There are many tutorials and learning resources for DAX if you know how to use a search engine. Or start here.
In essence: First you use Power Query (M) to query data sources, clean and load data. Then you use DAX to analyze the data in Power Pivot. Finally, you build pivot tables (Excel) or data visualisations with Power BI.
M is the first step of the process, getting data into the model.
(In PowerBI,) when you right-click on a dataset and select Edit Query, you're working in M (also called Power Query). There's a tip about this in the title bar of the edit window that says Power Query Editor. (but you have to know that M and PowerQuery are essentially the same thing). Also (obviously?) when you click the get data button, this generates M code for you.
DAX is used in the report pane of PowerBI desktop, and predominantly used to aggregate (slice and dice) the data, add measures etc.
There is a lot of cross over between the two languages (eg you can add columns and merge tables in both) - Some discussion on when to choose which is here and here
Think of Power Query / M as the ETL language that will be used to format and store your physical tables in Power BI and/or Excel. Then think of DAX as the language you will use after data is queried from the source, which you will then use to calculate totals, perform analysis, and do other functions.
M (Power Query): Query-Time Transformations to shape the data while you are extracting it
DAX: In-Memory Transformations to analyze data after you've extracted it
One other thing worth mentioning re performance optimisation is that you should "prune" your datatset (remove rows / remove columns) as far "upstream" - of the data processing sequence - as possible; this means such operations are better done in Power Query than DAX; some further advice from MS here: https://learn.microsoft.com/en-us/power-bi/power-bi-reports-performance