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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Recoba88
Helper III
Helper III

Aggregate 2 different columns in power query

Hi,

 

How can I aggregate these coulmns together ?

 

CHECK0909.PNG

 

Column1          Coulmn 2

Header 1          Data 1

Header 2          Data 2

Header 3          Data 3 

Header 4          Data 4 

Header 5          Data 5 

Header 7          Data 7

Header 8          Data 8

Header 10        Data 10

 

1 ACCEPTED SOLUTION

This would be the correct code (note: you use Column5, not Column4):

 

= Table.FromColumns({List.RemoveNulls(Source[Column1])&List.RemoveNulls(Source[Column3]),List.RemoveNulls(Source[Column2])&List.RemoveNulls(Source[Column5])})
Specializing in Power Query Formula Language (M)

View solution in original post

3 REPLIES 3
MarcelBeug
Community Champion
Community Champion

Post removed as it was incorrect.

Specializing in Power Query Formula Language (M)

This would be the correct code (note: you use Column5, not Column4):

 

= Table.FromColumns({List.RemoveNulls(Source[Column1])&List.RemoveNulls(Source[Column3]),List.RemoveNulls(Source[Column2])&List.RemoveNulls(Source[Column5])})
Specializing in Power Query Formula Language (M)
Anonymous
Not applicable

I would create two separate queries - one for columns 1 and 2; the other one - for column 3 and 5.

I would do some cleansing: Remove Empty values

I would give them Header and Data column names.

Then I would use Append Queries option

Hope this works

Michael

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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