March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hello all. I was wondering if I could get some help on how best to transform some data.
I have an export from some accounts software that I would like to create some Power BI visualisations on.
This is a sample of the data from the Excel sheet. It shows different account codes and descriptions, along with totals for each of those accounts for 2023, 2022, 2021 and 2020.
Account | Description | Year End 30/6/2023 | Year End 30/6/2022 | Year End 30/6/2021 | Year End 30/6/2020 |
1 | Sales | -1314413.96 | -1105903.5 | -1093038.37 | -950788.89 |
7 | Third-party sales | -6729.29 | 5229.13 | -4343.42 | -2221.34 |
44 | Wages | 143008.39 | 526602.99 | 448520.9 | 425935.17 |
53 | Sub contractors | 10498 | 9305 | 4350 | 2115.99 |
131 | Bank account interest | -473.61 | -35.04 | -120.65 | -76.28 |
229 | Rent | 28000 | 28000 | 28000 | 28000 |
230 | Rates and water | 3543.37 | 4304.98 | 3302.46 | 2916.25 |
232 | Insurance | 21613.66 | 17394.7 | 16806.56 | 15286.22 |
233 | Light and heat | 4678.09 | 4123.23 | 3487.26 | 2288.92 |
For example I would like to create a line chart visual which shows the increase in sales from 2020 to 2023.
Many thanks in advance.
Solved! Go to Solution.
In Power Query select the first two columns and then rightclick on the headers and select "unpivot other columns. This way you willl transform the table in such a way that you will get columns: Account, Description, YearEnd, ValueOfYearEnd. This way you can easily create visuals in Power BI Desktop.
Kudos and Mark as solution appreciated.
Follow these steps in Power Query Editor (refer the attached pbix file),
Unpivot Columns: In this step, all columns except "Account" and "Description" needs to be unpivoted.
Extract Text Using Range: Here, a transformation is applied to the "Attribute" column. It extracts a substring of text from each cell in the "Attribute" column, starting from the 9th character and spanning 18 characters.
Rename Columns: Rename the "Attribute" column to "Date" and the "Value" column to "Sales".
Change Data Type with Locale: Finally, the "Date" column needs to be transformed into a date type with a specified locale (English India).
@Arul Thank you for responding.
In the sample data, only the first row relates to the Sales account. The other 8 rows are unrelated to the first row.
From looking at the steps and the .pbix file all the values have been placed into the Sales column.
For account code '1 - Sales' the line chart would show the 4 years across the X-Axis and the values of -950788.89, -1093038.37, -1105903.50, -1314413.96 plotted on the Y-Axis.
For account code 131 - Bank account interest, the line chart would show the 4 years across the X-Axis and the values of -76.28, -120.65, -35.04 and -473.61 plotted on the Y-Axis.
For account codes 230 - Rates and water, 232 - Insurance, and 233 Light and heat, these would need to be grouped so the total for each year would be the three yearly figures for each of the three accounts combined.
This is how each graph would look (mocked up in Excel):
Sales:
Bank Account Interest:
Rates-Insurance-Light:
In Power Query select the first two columns and then rightclick on the headers and select "unpivot other columns. This way you willl transform the table in such a way that you will get columns: Account, Description, YearEnd, ValueOfYearEnd. This way you can easily create visuals in Power BI Desktop.
Kudos and Mark as solution appreciated.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
124 | |
87 | |
85 | |
70 | |
51 |
User | Count |
---|---|
205 | |
153 | |
97 | |
79 | |
69 |