Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Is it possible to achive transposing the table like below with null values? I've tried clicking on "Transpose" in Power query and it's not transforming the way I want.. any help would be appreciated!!
DeptID | Directors_math | Directors_sci |
111 | null | Haley |
111 | null | Jamie |
111 | null | Lee |
222 | AmyK | Jenny |
222 | AmyK | Sam |
Solved! Go to Solution.
Hi @Anonymous
You can try this. I have attached a sample file at bottom.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQ0VNJRyivNyQFSHok5qZVKsTpowl6JuZmpmMI+qRBBIyMjIM8xt9IbpDY1L68SUzg4MVcpNhYA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"DeptID " = _t, Directors_math = _t, Directors_sci = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"DeptID ", Int64.Type}, {"Directors_math", type text}, {"Directors_sci", type text}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"DeptID "}, {{"Directors_math", each [Directors_math], type nullable list}, {"Directors_sci", each [Directors_sci], type nullable list}}),
#"Extracted Values" = Table.TransformColumns(#"Grouped Rows", {"Directors_math", each Text.Combine(List.Transform(_, Text.From), ";"), type text}),
#"Extracted Values1" = Table.TransformColumns(#"Extracted Values", {"Directors_sci", each Text.Combine(List.Transform(_, Text.From), ";"), type text}),
#"Split Column by Delimiter" = Table.SplitColumn(#"Extracted Values1", "Directors_math", Splitter.SplitTextByDelimiter(";", QuoteStyle.Csv), {"Directors_math.1", "Directors_math.2", "Directors_math.3"}),
#"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Directors_math.1", type text}, {"Directors_math.2", type text}, {"Directors_math.3", type text}}),
#"Split Column by Delimiter1" = Table.SplitColumn(#"Changed Type1", "Directors_sci", Splitter.SplitTextByDelimiter(";", QuoteStyle.Csv), {"Directors_sci.1", "Directors_sci.2", "Directors_sci.3"}),
#"Changed Type2" = Table.TransformColumnTypes(#"Split Column by Delimiter1",{{"Directors_sci.1", type text}, {"Directors_sci.2", type text}, {"Directors_sci.3", type text}})
in
#"Changed Type2"
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it. Highly appreciate your Kudos!
= let a=Table.ColumnNames(Source) in Table.Combine(Table.Group(Source,"DeptID ",{"n",each #table({a{0}}&List.TransformMany(List.Skip(a),(x)=>List.Positions([#"DeptID "]),(x,y)=>x&"_"&Text.From(y+1)),{{[#"DeptID "]{0}}&List.Combine(List.Skip(Table.ToColumns(_)))})})[n])
Hi @Anonymous
You can try this. I have attached a sample file at bottom.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQ0VNJRyivNyQFSHok5qZVKsTpowl6JuZmpmMI+qRBBIyMjIM8xt9IbpDY1L68SUzg4MVcpNhYA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"DeptID " = _t, Directors_math = _t, Directors_sci = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"DeptID ", Int64.Type}, {"Directors_math", type text}, {"Directors_sci", type text}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"DeptID "}, {{"Directors_math", each [Directors_math], type nullable list}, {"Directors_sci", each [Directors_sci], type nullable list}}),
#"Extracted Values" = Table.TransformColumns(#"Grouped Rows", {"Directors_math", each Text.Combine(List.Transform(_, Text.From), ";"), type text}),
#"Extracted Values1" = Table.TransformColumns(#"Extracted Values", {"Directors_sci", each Text.Combine(List.Transform(_, Text.From), ";"), type text}),
#"Split Column by Delimiter" = Table.SplitColumn(#"Extracted Values1", "Directors_math", Splitter.SplitTextByDelimiter(";", QuoteStyle.Csv), {"Directors_math.1", "Directors_math.2", "Directors_math.3"}),
#"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Directors_math.1", type text}, {"Directors_math.2", type text}, {"Directors_math.3", type text}}),
#"Split Column by Delimiter1" = Table.SplitColumn(#"Changed Type1", "Directors_sci", Splitter.SplitTextByDelimiter(";", QuoteStyle.Csv), {"Directors_sci.1", "Directors_sci.2", "Directors_sci.3"}),
#"Changed Type2" = Table.TransformColumnTypes(#"Split Column by Delimiter1",{{"Directors_sci.1", type text}, {"Directors_sci.2", type text}, {"Directors_sci.3", type text}})
in
#"Changed Type2"
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it. Highly appreciate your Kudos!
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
15 | |
12 | |
8 | |
8 | |
7 |
User | Count |
---|---|
15 | |
13 | |
8 | |
7 | |
6 |