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
Hi,
Can I sort data from the table on the left (type A & B mixed in one column)to to the table on the right each type has its own qty column?
Sorry, I missunderstood your original post. I thought the table on the right was what you wanted to GET to. But that is one of the tables you already have? So what are you trying to do here? What would your final data look like?
Proud to be a Super User! | |
No, you understood my original post right. I want my final data look like table B, the one on the right.
My final goal is for table B to table A's connection to the SQL server. I have 2 senarios for solution:
1, Pivot. My understanding is once I do a pivot, my pivot table will be updated as my table A getting refreshed from the SQL server. If I merge this pivot to table B, would table B gets updated as table A?
2, Sort table A the same format like table B, then merge table A to table B so table B would have the same connection to SQL server and updates as the database update.
I thought senario 2, might be more straight forward, then I posted my original quetion.
So your data coming out of SQL Server looks like Table A, on thge left. What in your data tell you that the value of 10091 for A should be on the same row as 20024 for B? Is/are there some other column(s) involved?
Proud to be a Super User! | |
Yes and yes, there are other columns involved.
I will ask again: What in your data tell you that the value of 10091 for A should be on the same row as 20024 for B? Can you include that in the sample data?
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUTI0MLA0BNFKsTrRSk5AlpGBgZEJXASmxhhIG6OoMYOIxAIA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Type = _t, QTY = _t, ID = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Type", type text}, {"QTY", Int64.Type}}),
#"Pivoted Column" = Table.Pivot(#"Changed Type", List.Distinct(#"Changed Type"[Type]), "Type", "QTY", List.Sum)
in
#"Pivoted Column"
Proud to be a Super User! | |
Hi ToddChitt,
I got the left hand side table (A) from SQL server, and planning to merge A to the right hand side table (B), so the data for Type_A_QTY and Type_B_QTY stays up to date.
If I do a Pivot from Table A then merge to Table B, would the data in Table B get update when the data in my SQL server updates?
Thank you!
You should do a PIVOT operation in Power Query. Do you have some other column in there so you don't get a full SUM
Proud to be a Super User! | |
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 |
---|---|
29 | |
17 | |
11 | |
9 | |
8 |
User | Count |
---|---|
42 | |
24 | |
21 | |
13 | |
11 |