Data modelling in Power Bi - powerbi

I need to get in a few facts and dimension tables in power bi.
There are a few joins basically for my 3 dimension tables and 2 fact tables. The two fact tables are joined supposed to be joined with 1 and 3 dimension tables based on foreign keys. Now, my question is should I perform these joins in sql(backend) and get two datasets to powerbi or should I get all 5 tables (3 dimension tables and 2 fact tables) into powerbi and perform the joins in the data modelling of powerbi.
Which is the best approach considering the data size of the fact tables are huge?
Thank you

Related

How do I get a derived table from a matrix in PowerBI?

Hi I am very new to PowerBI and come from Looker. In Looker there is the concept of derived tables which allow you to join the results of a query to the model for additional analysis (similar to a CTE in SQL).
For example, let's say I have a matrix that gets the number of transactions from the table 1 aggregated by the index group name from table 2. How could I join this back onto table 2?
I can export to csv and load into the data model although this is limited to 30k rows.
Please let me know what is best practice here?
How can I save the results from a matrix visualization as a table to the model for additional analysis in PowerBI

new Power BI table combining unrelated data

I am trying to create a table that is a list of all possible combinations between two tables: products and companies. I'm building a dashboard in Power BI and the data comes from SQL queries. I have the following list structures for the Products table and the Companies table:
and my desired output for analysis is:
There is nothing that relates the companies to the products, and I'm trying to get a list of all of the products for each company. Can I do this in Power BI? If not, is it possible in SQL (there is nothing to join on)? Thank you for your help!
You can do this with a 'hacked' join, or a cross join. I prefer the former from a process POV, but cannot speak to speed or efficiency.
Using a Join ( Merge in PQ )
Create a new column 'DummyKey' with a value of 1 on each table.
Merge both tables using your 'DummyKey' columns.
Complete the Join process and choose the columns you want to bring through.
Cross Joins in PowerQuery according to MS
I think this 'cross join' is only technically right and does not provide future flexibility.
Both methods will get you to the same end point, and can be done in SQL or PQ.

Filtering plots in power BI on through column names

I have the following tables
I have several tables on coal consumption, natural gas, .....
I want to have a power BI model that can allow viewing these data with years (x-axis) while filtering on countries.
I have transposed the data to have a column with years and countries on the columns. But I cannot filter on countries.
Another thing I have done is to unpivot all the data and have four columns (country, year, value, fuel type) but the problem is that I could not manage to create suitable relationships between the tables as there is no primary key.
I have thought on putting all the data fro the different energy sources in one table. But how can I manage to link it to more data per country at year as well.
Another thing I have done is to unpivot all the data and have four columns (country, year, value, fuel type)
This is totally the right approach.
The next step required in minimum is to combine all unpivotted tables vertically into one EnergyConsumption table. You can utilize Append Queries command in Power Query Editor, or Table.Combine function in M language.
Additionally, you should consider to create three tables: Years, Countries, and FuelTypes, which have unique values of the respective dimensions, and establish one to many relationship with EnergyConsumption table.

Cross filtering between two facts and common dimension tables in Power BI Desktop

I have the following scenario.
I have two fact tables [FactA and FactB]. FactA and FactB contains 9 common dimensions and their own measures. I am trying to pull the measures from both fact tables into a table visualization and trying to filter the results using common dimensions. It works for the measure pulled from one fact table and not for the other fact table. I tried to set the cross filter direction to both on all the relationships between common dimensions and facts. I was able to set the cross filter for one dimension table, when I am trying to set the same for remaining dimensions, I am getting an warning that Power BI desktop allows only one filtering path between tables in a data model.
Also I tried to see if the cross filtering is working fine for the one dimension that I enabled cross filtering by pulling that dimension key and measures from both facts. But it didn't change anything.
Is there a way I can pull measures from both facts and have it filtered by common dimension values? Please share your thoughts and suggestion. Thanks in advance.
I have joined all the dimension tables to both fact tables. All dimension tables have 1 to many relationships with Fact tables. I have hidden all the dimension columns in report view for both fact tables. I just have measures visible on both Facts. In the visualization tab, I have pulled the measures from fact tables and dimension columns from dimension tables. It fixed the issue.
Also I learnt that, you can derive a new measure using other measures available in different fact tables.

power bi: combine multiple tables into one

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!