Forum Discussion
Help to customize table using existing data and calculations
Dear Power BI 🙂
I have the following data table (inserted below) I need to convert into a new table:
So essentially, I receive values for cars at given ages: Newbuild, 5, 10 and 15 years old.
From that data I need to make a table that show the value of a car at any given age. I need to fill in the values between newbuild and 5 year old and 10 years old etc. The way the numbers need to be filled in is by a linear depreciation. So if a Ford newbuild is worth 45 and a 5 years old Ford is worth 40, then the car have decreased by 5 over 5 years and thus 1 over 1 year. I think I have made the calculations clear in the picture.
My problem is that I have no Idea to make such a table in Power BI. The picture is from Excel, where this seems to be easy to do.
Can anyone help me?
Sincerely, Signe
| Date (value evaluation) | Car | Value type | Value |
| 3/2/2023 | Ford | New | 45 |
| 3/2/2023 | Ford | 5 year old | 40 |
| 3/2/2023 | Ford | 10 year old | 30 |
| 3/2/2023 | Ford | 15 year old | 20 |
| 3/2/2023 | VW | New | 35 |
| 3/2/2023 | VW | 5 year old | 30 |
| 3/2/2023 | VW | 10 year old | 20 |
| 3/2/2023 | VW | 15 year old | 10 |
| 3/2/2023 | Fiat | New | 28 |
| 3/2/2023 | Fiat | 5 year old | 25 |
| 3/2/2023 | Fiat | 10 year old | 20 |
| 3/2/2023 | Fiat | 15 year old | 15 |
1 Reply
- MAwwadSolution Sage
You can create the desired table in Power BI by using the following steps:
- Create a new table by going to "Modeling" > "New Table" in the ribbon.
- Use the following DAX formula to create the table:Car Value = VAR BaseTable = SELECTCOLUMNS('OriginalTable', "Car", [Car], "Value type", [Value type], "Value", [Value]) VAR NewTable = UNION(BaseTable, SELECTCOLUMNS(BaseTable, "Value type", "Newbuild", "Value", 0)) RETURN ADDCOLUMNS(NewTable, "Date", TODAY())
In this formula, replace 'OriginalTable' with the name of the original table that contains the data you provided. This formula creates a new table called "Car Value" that has one row for each combination of Car and Value type. The Value column is filled in using a linear interpolation between the available values.
- Create a new matrix visual and add "Car" to the Rows field, "Date" to the Columns field, and "Value type" to the Values field.
- In the "Values" field, click on the dropdown arrow and select "Don't summarize". This will ensure that each row in the matrix shows the actual value from the "Car Value" table.
I hope this helps! Let me know if you have any questions.