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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
MrTD
Frequent Visitor

Building a path based of column data in Power Query

Hey,

I need to build a table in Power BI (preferably in Power Query) based of dates.  I want to create a series of data in a column (I can split it later) where the ID is the same. Poorly explained so an example:

 A user with ID "1" has numerous rows in a table with different dates. On each row there's another column with data about the user "1".WGBaGFz8QAKPHIncoasjsw

 I'd like to create another table where it has the ID "1" and a column(s) probably seperated with commas with all the data information about "1" in order of earliest to latest date.
Also there are numerous other ID's with all this information.

1VUKWR_7Rx6_dvfKp_2qrA

 


I thought of doing a pivot table but this is fairly new to me so I don't know the specifics. Thing is I can do this in Excel/VBA but when it comes to this there's no good documentation 😞 EDIT: Plus the table I'm working with has 7 million rows, so I figured Power BI would be the best tool for this.

 

I also have another question.  I also want to do the same thing but based of the date where the data in the second column is the week number of the date, also seperated by columns. This seems like a lot to ask I think, but could also someone explain what they've done as I want to learn ad deepen my knowledge too Smiley Mad

 

thank you!


2 ACCEPTED SOLUTIONS
TomMartens
Super User
Super User

Hey,

 

you can use the function CONCATENATEX(...) to combine values from different rows in one cell.

 

Here I describe this approach:

https://community.powerbi.com/t5/Desktop/Item-Mix-Visualization/td-p/208161/page/2

 

If this is not what you're are looking for, please provide easily accessible data (e.g. copy data from excel and paste into the code window)

 

Hope this helps



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

MarcelBeug
Community Champion
Community Champion

Prerequisite: column OtherData is in text format.

 

I used option "Group By" with operation "All Rows" and adjusted the code to have the resulting tables (1 per ID) sorted by DateTime, and OtherData combined to 1 CSV string.

 

Edit: "1 table per ID" is during the Group By operation. The end result is 1 table in total.

 

let
    Source = Table1,
    #"Grouped Rows" = Table.Group(Source, {"ID"}, {{"data", each Text.Combine(Table.Sort(_, "DateTime")[OtherData],","), type text}})
in
    #"Grouped Rows"

 

Not sure if this will perform well, with 7 million rows...

Specializing in Power Query Formula Language (M)

View solution in original post

3 REPLIES 3
MarcelBeug
Community Champion
Community Champion

Prerequisite: column OtherData is in text format.

 

I used option "Group By" with operation "All Rows" and adjusted the code to have the resulting tables (1 per ID) sorted by DateTime, and OtherData combined to 1 CSV string.

 

Edit: "1 table per ID" is during the Group By operation. The end result is 1 table in total.

 

let
    Source = Table1,
    #"Grouped Rows" = Table.Group(Source, {"ID"}, {{"data", each Text.Combine(Table.Sort(_, "DateTime")[OtherData],","), type text}})
in
    #"Grouped Rows"

 

Not sure if this will perform well, with 7 million rows...

Specializing in Power Query Formula Language (M)

Thanks this is what I needed!

TomMartens
Super User
Super User

Hey,

 

you can use the function CONCATENATEX(...) to combine values from different rows in one cell.

 

Here I describe this approach:

https://community.powerbi.com/t5/Desktop/Item-Mix-Visualization/td-p/208161/page/2

 

If this is not what you're are looking for, please provide easily accessible data (e.g. copy data from excel and paste into the code window)

 

Hope this helps



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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