cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Pinky0404
Helper III
Helper III

Pivot Column with Don't aggregate

Hi All,

 

Can somebody please help me get the expected results as below. I tried using Pivot column with Dont aggregate but i am getting an error for list

Sample Data1.PNG

Thanks in advance!!

 

 

 

1 ACCEPTED SOLUTION
MarcelBeug
Community Champion
Community Champion

Pivot without aggregation won't combine values for you, as you are expecting for the modules that are completed by Mr/s b.

 

So you can first use "Group By" to combine those values: select all columns except "Module Name", choose "Group By" with operation Maximum for column Module Name (this is just a dummy operation to have basis code generated) and adjust the code to have the module names combined.

Now you can pivot.

 

let
    Source = Table1,
    #"Grouped Rows" = Table.Group(Source, {"Name", "Email", "Module Status"}, {{"Modules", each Text.Combine([Module name],","), type text}}),
    #"Pivoted Column" = Table.Pivot(#"Grouped Rows", List.Distinct(#"Grouped Rows"[#"Module Status"]), "Module Status", "Modules")
in
    #"Pivoted Column"
Specializing in Power Query Formula Language (M)

View solution in original post

5 REPLIES 5
MarcelBeug
Community Champion
Community Champion

Pivot without aggregation won't combine values for you, as you are expecting for the modules that are completed by Mr/s b.

 

So you can first use "Group By" to combine those values: select all columns except "Module Name", choose "Group By" with operation Maximum for column Module Name (this is just a dummy operation to have basis code generated) and adjust the code to have the module names combined.

Now you can pivot.

 

let
    Source = Table1,
    #"Grouped Rows" = Table.Group(Source, {"Name", "Email", "Module Status"}, {{"Modules", each Text.Combine([Module name],","), type text}}),
    #"Pivoted Column" = Table.Pivot(#"Grouped Rows", List.Distinct(#"Grouped Rows"[#"Module Status"]), "Module Status", "Modules")
in
    #"Pivoted Column"
Specializing in Power Query Formula Language (M)

View solution in original post

Thank you! Now, values cominng in comma separated, I would like to disply each row wise Like below

 

 

           
Source   Expected Result  Now its displaying 
Col 1Col2         
A1  ABC ABC
B2  123 1,52,63,7
C3  567    
A5         
B6         
C7         
           

 

 

Is it possible to disply values like above?

Hi @harish_hpe ,

 

You can try to use the following m-query:

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUTJUitWJVnICsozALGcgyxjMAsmawGVN4bJmSrGxAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Team = _t, Value = _t]),
    #"Grouped Rows" = Table.Group(Source, {"Team"}, {{"Count", each _, type table [Team=nullable text, Value=nullable text]}}),
    #"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each Table.AddIndexColumn([Count],"index",1)),
    #"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Team", "Count"}),
    #"Expanded Custom" = Table.ExpandTableColumn(#"Removed Columns", "Custom", {"Team", "Value", "index"}, {"Custom.Team", "Custom.Value", "Custom.index"}),
    #"Renamed Columns" = Table.RenameColumns(#"Expanded Custom",{{"Custom.Team", "Team"}, {"Custom.Value", "Value"}, {"Custom.index", "index"}}),
    #"Pivoted Column" = Table.Pivot(#"Renamed Columns", List.Distinct(#"Renamed Columns"[Team]), "Team", "Value")
in
    #"Pivoted Column"

 

Capture11.PNG

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Best Regards,

Dedmon Dai

Thank you! Now, values cominng in comma separated, I would like to disply each row wise Like below

 

 

           
Source   Expected Result  Now its displaying 
Col 1Col2         
A1  ABC ABC
B2  123 1,52,63,7
C3  567    
A5         
B6         
C7         
           

 

 

Is it possible to disply values like above?


Great!! Thank You Sir, It Worked Perfectly.

Helpful resources

Announcements
PBI_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

MBAS on Demand

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Get Ready for Power BI Dev Camp

Microsoft named a Leader in The Forrester Wave

Microsoft received the highest score of any vendor in both the strategy and current offering categories.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Top Kudoed Authors