Today is my first day to use PowerBI 2.0 Desktop.
Is there any way to add new columns from external data into the existing table in my PowerBI?
Or is there anyway to add new columns from another table in PowerBI?
It seems that, in PowerQuery, all the tabs Add Custom Column, Add Index Column and Duplicate Column are all using the existing columns in the same table.....
You can use Merge Queries to join together two queries, which will let you bring in the other table's columns.
Also, Add Custom Column accepts an arbitrary expression, so you can reference other tables in that expression. For example, if Table1 and Table2 had the same number of rows, I could copy over Table2's column by doing the following:
Add an Index Column. Let's call it Index.
Add a Custom Column with the following expression: Table2[ColumnName]{[Index]}
Related
My dimension tables contains more rows than my fact table, I would like my dim table fields to show only the values in the fact table when used as a filter in the filter panel.What cleaning/modeling steps are the best to achieve this.
I also know how to write sql if that is an option for an answer.
Rather than use a table for your dimension, use a view that has an inner join to the fact table
Is it possible to include columns from 2 different tables in DAX Switch Function ?
Both of my tables are linked by Many to Many Relationship.
I am trying to create a calculated column in Table A where I want to compare Columns from Table B, but I can't add the Table B column in the DAX Switch formula.
Any suggestions would be appreciated.
Thanks & Regards,
Pratik
Sample
Table B
Table A & Expected Result
In my opinion, it doesn't matter whether this table has many relationship, the only thing matter is that you are calculated based on your original table instead of calculate on a new measure, then result is unpredictable:
By create new table from the original table, and add column for the comment, I can provide result as your expectation, hope it solve your problem and accept the answer :)
Create new table from original table (Sheet1 is my old table) and select on ID column
Table = SELECTCOLUMNS(Sheet1,"ID",Sheet1[ID])
Create new column for comment
Column = SWITCH(LOOKUPVALUE('Sheet1'[Value],Sheet1[ID],'Table'[ID]), 0,"Matched with A","Matched with B")
The outcome for the new table:
Instead of trying to use two columns from two different tables for comparison in DAX, you can use the 'RELATED` DAX function to import a column from Table A to Table B or vice-versa. Then you can use this column for comparison in DAX.
Just set the appropriate relationship between Table A and Table B and create a new column with the RELATED DAX function to import the table that you want to use in the SWITCH function.
Simple question: I have a table that needs to be split into 2 tables via a row split and not the column split. How can I achieve this?
Thanks.
Duplicate the table, then delete the columns that you do not need from each of the copies.
To duplicate the table, open Power Query Editor by clicking on Edit Queries, right click your table and select Duplicate:
Then in each of the copies, right click on the header of the columns that you don't want, and select Remove. Alternatively, you can select the columns that you want to keep, and select Remove other columns.
I want to create a second table from the first table using filters with dates and other variables as follows. How can I create this?
Following is the expected table and original table,
Go to Edit Queries. Lets say our base table is named RawData. Add a blank query and use this expression to copy your RawData table:
=RawData
The new table will be RawDataGrouped. Now select the new table and go to Home > Group By and use the following settings:
The result will be the following table. Note that I didnt use the exactly values you used to keep this sample at a miminum effort:
You also can now create a relationship between this two tables (by the Index column) to use cross filtering between them.
You could show the grouped data and use the relationship to display the RawDate in a subreport (or custom tooltip) for example.
I assume you are looking for a calculated table. Below is the workaround for the same,
In Query Editor you can create a duplicate table of the existing (Original) table and select the Date Filter -> Is Earliest option by clicking right corner of the Date column in new duplicate table. Now your table should contain only the rows which are having minimum date for the column.
Note: This table is dynamic and will give subsequent results based on data changes in the original table, but you to have refresh both the table.
Original Table:
Desired Table:
When I have added new column into it, post to refreshing dataset I have got below result (This implies, it is doing recalculation based on each data change in the original source)
New data entry:
Output:
Working on a way to compare 2 tables in PowerBI.
I'm joining the 2 tables using the primary key and making custom columns that compare if the old and new are equal.
This doesn't seem like the most efficient way of doing things, and I can't even color code the matrix because some values aren't integers.
Any suggestions?
I did a big project like this last year, comparing two versions of a data warehouse (SQL database).
I tackled most of it in the Query Editor (actually using Power Query for Excel, but that's the same as PBI's Query Editor).
My key technique was to first create a Query for each table, and use Unpivot Other Columns on everything apart from the Primary Key columns. This transforms it into rows of Attribute, Value. You can filter Attribute to just the columns you want to compare.
Then in a new Query you can Merge & Expand the "old" and "new" Queries, joining on on the Primary Key columns + the Attribute column. Then add Filter or Add Column steps to get to your final output.