combine repeating columns - powerbi

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.

Related

Source Data CSV with variable number of columns

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

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

Generate dynamic time representation using DAX

I am relatively new to PowerBI and struggling to accomplish the following task.
I have in total 3 Tables. 2 Tables are available and the 3rd is the outcome I am interested in.
Table 1 is a lookup table with yearly values for each option of a certain property.
Table 2 is a user input table containing the project list with a property that can be equal to one of the options in Table 1.
I am mostly interested in Mapping the projects with their yearly development based on one property. The outcome is represented in Table 3.
At the end of the day, I would like to plot the Sum across all projects against the year column (The 2 columns in red).
I hope someone can help here in finding the appropriate DAX logic. Thanks in advance!
You can bring the tables into a Power BI model, and from the modeling tab you can create relationships to accomplish this. Let me know if this is helpful.

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.

Power BI Countif between two tables

Hello Stackoverflow community,
I am a novice in Power BI DAX syntax writing and am desperate for assistance on a problem at work.
Here's the short of it: I have one table which has the RAW data being pulled from Smartsheet. I have a second table I made for a weighted calculation which I cannot figure out how to write.
In this other table I made, I'll call it WEIGHTEDTABLE, I have a [Brand] column with text I typed in when I made the table (Brand1, Brand2, etc). Then I have two columns which I would like to populate with a formula. These two other columns are for Item1 and Item2.
The reason behind this is I can have a graph with just counts of Item1 and Item2 for each brand, but that is not fair/accurate because some brands have more of an item than another (which is why I want to created a WEIGHTED table).
The graph I want to create would have the Brands on the Axis, and the values would be the COUNT of Item1 and Item2 / the appropriate number that I will enter (let's just say it's 25 for Item1 and 10 for Item2).
So ideally, it would be a COUNTIF or IF - if [Brand] from the RAW table = [Brand] from the table I entered, then there would be a COUNT of Item1 from the RAW table divided ( / ) by a 25 or 10.
That's it! Perhaps there is a much easier way to do this. Anything helps and I really appreciate the time and effort that goes into responses!