Forum Discussion
How to expand table with assigned distinctive column
Hi CornelisV,
Take a look at my pbix file and see if this is what you're looking for.
Dear _AAndrade ,
Thank you for your support. i have looked at the pbix file and it is not quite the solution. The original source is a table without column 'group'.
Although the table looks simple, actually the original format is > 10,000 rows and > 10 columns. I would like to import only in one time to save loading time into Power BI.
The question is: how can I expand the table starting from the original table above and result into table below without importing two times via ODBC.
Best regards,
- _AAndrade2 years ago
Resident Rockstar
Hi CornelisV,
In my solution the initial table don't have the group column as well. You can see this in the source step. I use a step on power query to add the group column.
I did some changes on my code and put all in one query, here is the M code:let // Original Source Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjTWNTDUNTIwMlEwNLYyMlDSUQJhQ6VYHXRJY4gESAGmpAk+SVPcxppYGeCTNMQnice1JvhcawJxLVRnLAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Time = _t, Valve1 = _t, Valve2 = _t]), ChangeType = Table.TransformColumnTypes(Source, {{"Time", type datetime}, {"Valve1", Int64.Type}, {"Valve2", Int64.Type}}), FirstTable = Table.AddColumn(ChangeType, "Group", each 1, Int64.Type), SecondTable = Table.AddColumn(ChangeType, "Group", each 2, Int64.Type), FinalTable = Table.Combine({FirstTable, SecondTable}) in FinalTable
As you can see you only need to import one time the source and the final result is what you put oin your example.
I hope this could help you.- CornelisV2 years ago
Helper IV
Hi _AAndrade , thank you for your effort. This is exact what I'm looking for. I have already pasted in the Advanced Editor and understand the rule of game to implement.
Best regards, Cornelis
- _AAndrade2 years ago
Resident Rockstar
Great. As my post solved your issue, please mark my post as a solution! Kudos are welcome, too 🙂
Thanks