Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.
Good
I have a table in the query where I have three columns with an information. The following happens to me:
- In these three columns I want to do the "Undo Dynamization of the columns" so that in the same column are all the attributes.
- On the other hand I am also interested in having these three columns separately where each column represents a value of the attribute.
From each case I will draw a different metric. It is necessary to have it in both ways.
What is the most optimal way to work this table to have both options?
The way I have thought is the following (I give you an example):
1. Original table:
Year | Africa | HAD | America |
2001 | 56 | 72 | 83 |
2002 | 57 | 73 | 84 |
2003 | 58 | 74 | 85 |
2. Make a copy of the three columns.
Year | Africa | HAD | America | Africa-copy | EU-copying | America-copia |
2001 | 56 | 72 | 83 | 56 | 72 | 83 |
2002 | 57 | 73 | 84 | 57 | 73 | 84 |
2003 | 58 | 74 | 85 | 58 | 74 | 85 |
3. Make dynamization of the three columns and leave them as they are.
Year | Africa-copy | EU-copying | America-copia | Attribute | Value |
2001 | 56 | 72 | 83 | Africa | 56 |
2001 | 56 | 72 | 83 | HAD | 72 |
2001 | 56 | 72 | 83 | America | 83 |
2002 | 57 | 73 | 84 | Africa | 57 |
2002 | 57 | 73 | 84 | HAD | 73 |
2002 | 57 | 73 | 84 | America | 84 |
2003 | 58 | 74 | 85 | Africa | 58 |
2003 | 58 | 74 | 85 | HAD | 74 |
2003 | 58 | 74 | 85 | America | 85 |
That is, before doing the dynamization make a copy of the three columns to leave them as they were. So I have both forms.
Can the table bring problems like this? Does that make sense? What other option can be proposed?
Another option could be to simply upload the table twice, but it forces me to relate it to the rest of the tables again.
Thanks in advance.
Best regards.
Ok. Thanks for the reply. So I will. Best regards.
You don't need to do that. Instead, unpivot your data to make it usable for Power BI.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwMFTSUTI1AxLmRkDCwlgpVgcsDuKZmoPEjUHiJjBxEM/UAiRuAhI3VYqNBQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Year = _t, Africa = _t, HAD = _t, America = _t]),
#"Unpivoted Other Columns" = Table.UnpivotOtherColumns(Source, {"Year"}, "Region", "Value"),
#"Changed Type" = Table.TransformColumnTypes(#"Unpivoted Other Columns",{{"Year", Int64.Type}, {"Value", Int64.Type}})
in
#"Changed Type"
Check out the November 2023 Power BI update to learn about new features.
Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.