Source Data CSV with variable number of columns - powerbi

I'm managing a Source CSV with a table with this structure of columns:
Date | House A Power Consumption | House B Power Consumption | House C Power Consumption |
It has the power consumption values by hours of each house. In order to manage this data in Power Bi, I have to unpivot all the houses columns keeping the date column.
The problem occurs when I change the source file, for example, If I want to add a new House D, everything changes because in the Source step of the Power Query, it adds another column with empty values that it will be empty rows (except in the Date column) after the unpivot step.
How can I deal with this? I would like to add or remove different Columns (Houses) and have the unpivot table with the useful data.
Thanks for your help!
Regards

Related

combine repeating columns

I have an Excel sheet I uploaded into Power BI. I am trying to organize hundreds of columns, so I only have 4 columns: Date, Facility, Rooms and Profit. I would like to have all facilities in column B, all rooms in column C and all profits in column D. That way I can sort by Date. Is this possible? Thanks ahead for any advice on how to go about this.

Power BI: How to Create a Matrix with Row Headers = Data label, Column Headers = Measures

I have a dataset consist of two time series: e.g. Historical stock prices for Apple and Microsoft. And I have a few different power BI measures created for each of these two stocks (e.g. Weekly Return, Monthly Return).
I want to create a "Matrix"-like visual, to show:
stock names as the row headers
measures as the column headers
values being the corresponding measure value for the given date selected on a date slicer
To illustrate what I want to do, please see the picture from Excel as an example. Is there a convenient way to do this in Power BI?
Thank you very much for your help!
Excel illustration on what the visual should look like in Power BI

Calculated column in Power BI that repeats different sums based on conditions in 2 other columns

I need a calculated column based on conditions in two columns (Business Unit Number in both tables and L1/Account Categories in 1st table and the second table) which sum and then repeat for several rows before the conditions change and a new sum is repeated for several rows and so on. The L1/Account Categories columns have different names because it's the raw data.
For example, any time ASSETS and 111 appear in the same row, I would want to use those as conditions and with the sum of all of the other matching rows in a new column and the sum would repeat each time both conditions appeared in the same row. Any time P/L and 111 appear in the same row, that would be a sum of all other P/L and 111 appearances in the dataset (about 1000 rows overall)... and so on.
I've tried formulas with DAX using FILTER, SUMX, nested IF statements and also tried the Power Query language among other attempts. Maybe I have to create one or more than one new table? If you need to take a look at a few of my attempts, just let me know.
The top image is how I imagine the output will look in the power query editor and the bottom image is a sample of the source data.
This last pic is from Tableau - I need to make a table in Power BI which essentially a duplicate of this image. The last 2 columns are pulling from different tables.
This should be very simple to achieve with relationships and measures - no need for calculated columns or power query merges. You need to build a relationship between these two tables. In fact, I would introduce a third table in your model for Business unit.
The limitation of Power BI model relationships is that they can only be based on a single column. So to build a relationship between these two tables you would have to add a calculated column in both of them that would contain both a BU and the financial statement line, for instance: JoinCol = CONCATENATE([Business_Unit_Number], [L1]). Then you could create a relationship and do what you want.
The better (one that I would recommend) approach would be to separate Business Unit into a separate table and have relationships built like this:
Then all you have to do in your visual is drag Business unit name from the BU table, L1 from the FS Lines table and a measure to sum the amounts Amount = SUM('Financial Data'[Rolled Up Detail]).
Here is a working sample: https://1drv.ms/u/s!AmqvMyRqhrBpgtUT5HKnZP1U3Gzc9w?e=en91dV

Show All Column Values

Is it possible to show a column in a matrix table when there is no row in the dataset. E.g in Excel you can create a manual table as below and when data exists it populates according. So if the dataset has no row for 100 Days + this should show as 0. But in Power BI the columns only show if there is data. So the tables are all different sizes. 
What i want to show is the below but i am only getting 3 columns in power bi (0-1 days, 2-7 days and 8-14 days) and not the whole groups 
Any help is appreciated! 
Yasir

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.