Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
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
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
90 | |
88 | |
83 | |
64 | |
49 |
User | Count |
---|---|
127 | |
108 | |
87 | |
70 | |
66 |