Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hello I have my source in a similar format as the picture below;
The format that I want to switch this to is have the months in one column and have 2 seperate columns for 2018 and 2019 sales.
Thanks in advance
Hi,
In my opinion its always better to transform the input table to row level and use visuals to get de desired result. I made a sample .pbix with both the transformation to row level and the desired table. U can download the file here: https://we.tl/t-PfxLo5Av6T.
To get to the row level I first Transposed the table. Then I removed 'Sales' from the year column (not necessary). Ater that I Promoted the first row to headers and renamed them. After that I selected the product columns and unpivoted them to get to row level ('Convert to Rows' table in file). Within the report I made a Matix that shows the desired result.
To get the result using Power Query after the row level there is one more stap ('Option 2' table in file). That is to select the Year column and then choose Pivot and select 'sales' as Value Column. By default the Aggregate function is SUM.
Hope this is useful.
Gr,
Jesse
Hi,
You can unpivot the column 2018 1 sales - 2019 12 sales to row data like picture below. Renamed the new column .Or could you please share your sample data or desired output screenshots for further analysis? You can also upload sample pbix to OneDrive and post the link here. Do mask sensitive data before uploading.
For example:
Best Regards,
Amy
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you for the help,
Yeah I realized I wasn't very clear with my question. Basically I have different monthly data in columns like 2018 Jan sales, 2018 Feb sales, ... 2019 Jan sales, 2019 Feb sales, ... and I wanna have the months in one column and have 2 columns for 2018 sales and 2019 sales like this;
I tried to unpivot the first 12 column and then the other 12 column but it doesnt work.
Thanks again
Check out the September 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
101 | |
98 | |
97 | |
38 | |
37 |
User | Count |
---|---|
152 | |
121 | |
73 | |
71 | |
63 |