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
I have two tables.
One contains the data separated by a line, and the other by column
For example:
How can I get the Total Employer data from the First table and put it in the Second Table in the Related Field?
The result would be this. I am not able to perform.
Solved! Go to Solution.
Hi, @BobPanna ;
You could merge it in power query.
1.Merge it.
2.expand year and employer total.
3.add new column
4.pivot column.
The final show:
M language.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQyNlHSUTIyMLQAU0ZGQMovtVzBvyC1KLEkMz8PyHfOzyvJzCtNLSaSjY5idaKVTM3MITYYWkIsMgRZpO9IinU5+cWpKdjMjwUA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Index 2" = _t, #"lnicia lYe<" = _t, #"Last Year" = _t, #"2018 Status" = _t, #"2019 Status" = _t, #"2020 Status" = _t, #"2021Status" = _t, #"2022 Status" = _t, #"2018 Employers Total" = _t, #"2019 Employers Total" = _t, #"(blank)" = _t, #"2020 Employers Total" = _t, #"2021Employers Total" = _t, #"2022 Employers Total" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Index 2", Int64.Type}, {"lnicia lYe<", Int64.Type}, {"Last Year", Int64.Type}, {"2018 Status", type text}, {"2019 Status", type text}, {"2020 Status", type text}, {"2021Status", type text}, {"2022 Status", type text}, {"2018 Employers Total", type text}, {"2019 Employers Total", type text}, {"(blank)", type text}, {"2020 Employers Total", type text}, {"2021Employers Total", type text}, {"2022 Employers Total", type text}}),
#"Renamed Columns" = Table.RenameColumns(#"Changed Type",{{"lnicia lYe<", "lnicia Year"}}),
#"Removed Columns" = Table.RemoveColumns(#"Renamed Columns",{"2018 Employers Total", "2019 Employers Total", "(blank)", "2020 Employers Total", "2021Employers Total", "2022 Employers Total"}),
#"Merged Queries" = Table.NestedJoin(#"Removed Columns", {"Index 2"}, Table, {"Index2"}, "Table", JoinKind.LeftOuter),
#"Expanded Table" = Table.ExpandTableColumn(#"Merged Queries", "Table", {"Employers Total", "Year"}, {"Table.Employers Total", "Table.Year"}),
#"Added Custom" = Table.AddColumn(#"Expanded Table", "Custom", each Number.ToText( [Table.Year])&" Employers Total"),
#"Removed Columns1" = Table.RemoveColumns(#"Added Custom",{"Table.Year"}),
#"Pivoted Column" = Table.Pivot(#"Removed Columns1", List.Distinct(#"Removed Columns1"[Custom]), "Custom", "Table.Employers Total", List.Sum),
#"Replaced Value" = Table.ReplaceValue(#"Pivoted Column",null,0,Replacer.ReplaceValue,{"2018 Employers Total", "2019 Employers Total", "2020 Employers Total", "2021 Employers Total", "2022 Employers Total"})
in
#"Replaced Value"
Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @BobPanna ;
You could merge it in power query.
1.Merge it.
2.expand year and employer total.
3.add new column
4.pivot column.
The final show:
M language.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQyNlHSUTIyMLQAU0ZGQMovtVzBvyC1KLEkMz8PyHfOzyvJzCtNLSaSjY5idaKVTM3MITYYWkIsMgRZpO9IinU5+cWpKdjMjwUA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Index 2" = _t, #"lnicia lYe<" = _t, #"Last Year" = _t, #"2018 Status" = _t, #"2019 Status" = _t, #"2020 Status" = _t, #"2021Status" = _t, #"2022 Status" = _t, #"2018 Employers Total" = _t, #"2019 Employers Total" = _t, #"(blank)" = _t, #"2020 Employers Total" = _t, #"2021Employers Total" = _t, #"2022 Employers Total" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Index 2", Int64.Type}, {"lnicia lYe<", Int64.Type}, {"Last Year", Int64.Type}, {"2018 Status", type text}, {"2019 Status", type text}, {"2020 Status", type text}, {"2021Status", type text}, {"2022 Status", type text}, {"2018 Employers Total", type text}, {"2019 Employers Total", type text}, {"(blank)", type text}, {"2020 Employers Total", type text}, {"2021Employers Total", type text}, {"2022 Employers Total", type text}}),
#"Renamed Columns" = Table.RenameColumns(#"Changed Type",{{"lnicia lYe<", "lnicia Year"}}),
#"Removed Columns" = Table.RemoveColumns(#"Renamed Columns",{"2018 Employers Total", "2019 Employers Total", "(blank)", "2020 Employers Total", "2021Employers Total", "2022 Employers Total"}),
#"Merged Queries" = Table.NestedJoin(#"Removed Columns", {"Index 2"}, Table, {"Index2"}, "Table", JoinKind.LeftOuter),
#"Expanded Table" = Table.ExpandTableColumn(#"Merged Queries", "Table", {"Employers Total", "Year"}, {"Table.Employers Total", "Table.Year"}),
#"Added Custom" = Table.AddColumn(#"Expanded Table", "Custom", each Number.ToText( [Table.Year])&" Employers Total"),
#"Removed Columns1" = Table.RemoveColumns(#"Added Custom",{"Table.Year"}),
#"Pivoted Column" = Table.Pivot(#"Removed Columns1", List.Distinct(#"Removed Columns1"[Custom]), "Custom", "Table.Employers Total", List.Sum),
#"Replaced Value" = Table.ReplaceValue(#"Pivoted Column",null,0,Replacer.ReplaceValue,{"2018 Employers Total", "2019 Employers Total", "2020 Employers Total", "2021 Employers Total", "2022 Employers Total"})
in
#"Replaced Value"
Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
22 | |
19 | |
16 | |
9 | |
5 |
User | Count |
---|---|
37 | |
29 | |
16 | |
14 | |
12 |