Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get 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

Reply
Anonymous
Not applicable

How to group and pivot records exclude nulls

Hello

I have such table (a lot of records, it's just example):

screen1.jpg

 

I need to get in PBI such result:

screen2.jpg

 

Please help.

1 ACCEPTED SOLUTION
Zubair_Muhammad
Community Champion
Community Champion

@Anonymous 

 

Please check if this helps

See File attached as well for the steps

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUTICYqVYHQgHiMwgHEMzEyDH0BwuCxFAVwBE5kqxsQA=", BinaryEncoding.Base64), Compression.Deflate)), 
    let _t = ((type text) meta [Serialized.Text = true]) in type table [tickets_id = _t, Author = _t, Assighnee = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"tickets_id", Int64.Type}, {"Author", Int64.Type}, {"Assighnee", Int64.Type}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"tickets_id"}, 
    {{"Author", each List.First(List.RemoveNulls([Author]))},
    {"Assighnee", each Text.Combine(List.RemoveNulls(List.Transform([Assighnee],each Text.From(_))),",") }}),
    #"Split Column by Delimiter" = Table.SplitColumn(#"Grouped Rows", "Assighnee", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), {"Assighnee.1", "Assighnee.2"})
in
    #"Split Column by Delimiter"

Regards
Zubair

Please try my custom visuals

View solution in original post

2 REPLIES 2
Zubair_Muhammad
Community Champion
Community Champion

@Anonymous 

 

Please check if this helps

See File attached as well for the steps

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUTICYqVYHQgHiMwgHEMzEyDH0BwuCxFAVwBE5kqxsQA=", BinaryEncoding.Base64), Compression.Deflate)), 
    let _t = ((type text) meta [Serialized.Text = true]) in type table [tickets_id = _t, Author = _t, Assighnee = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"tickets_id", Int64.Type}, {"Author", Int64.Type}, {"Assighnee", Int64.Type}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"tickets_id"}, 
    {{"Author", each List.First(List.RemoveNulls([Author]))},
    {"Assighnee", each Text.Combine(List.RemoveNulls(List.Transform([Assighnee],each Text.From(_))),",") }}),
    #"Split Column by Delimiter" = Table.SplitColumn(#"Grouped Rows", "Assighnee", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), {"Assighnee.1", "Assighnee.2"})
in
    #"Split Column by Delimiter"

Regards
Zubair

Please try my custom visuals
Anonymous
Not applicable

@Zubair_Muhammad 

It really works! Thank you!

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.