cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
aakashdmorya
Frequent Visitor

Converting rows to columns in SharePoint Online List Report

I have 2 SharePoint List.

Project (Project_ID, Project_Title) and Project_Tasks(Project_ID, Tasks_Title) [here Project_ID is lookup column from Project list.]

I have data as:

Project:

Project_IDProject_Title
P-1Project-1
P-2Project-2
P-3Project-3

Project_Tasks:

Project_IDTasks_Title
P-1Tasks-1
P-1Tasks-2
P-2Tasks-3
P-2Tasks-4
P-2Tasks-5

I am able to generate the following report.

Project_IDProject_TitleTasks
P-1Project-1Tasks-1
P-1Project-1Tasks-2
P-2Project-2Tasks-3
P-2Project-2Tasks-4
P-2Project-2Tasks-5

But My requirement is to generate a report like

Project_IDProject_TitleTasks
P-1Project-1
Tasks-1Tasks-2
P-2Project-2
Tasks-3Tasks-4Tasks-

In this case, the Pivoting will not help me. I have alreadty tried.

Please help. Any reference link, tutorial video or suggestion is most welcome

 

You can download my sample file here.

 

PowerBI Report File

1 ACCEPTED SOLUTION

Accepted Solutions
Super User IV
Super User IV

Re: Converting rows to columns in SharePoint Online List Report

Hi @aakashdmorya 

Please see the link to the pbix file below.
https://drive.google.com/file/d/1nyNdko2K-q5O1zan-P02b5jCKR9HMo1w/view?usp=sharing

 

Let me know if you expirience any problems
Mariusz

View solution in original post

6 REPLIES 6
Super User IV
Super User IV

Re: Converting rows to columns in SharePoint Online List Report

Hi @aakashdmorya 

You can use Query Editor, please see the below M code

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCtA1VNJRCijKz0pNLgGzQxKLs4uBrFgd3LJGUFkjJFkjuKwxXlkTvLKmSrGxAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Project_ID = _t, Project_Title = _t, Tasks = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Project_ID", type text}, {"Project_Title", type text}, {"Tasks", type text}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"Project_ID", "Project_Title"}, {{"Tasks", each _[Tasks], type list}}),
    #"Extracted Values" = Table.TransformColumns(#"Grouped Rows", {"Tasks", each Text.Combine(List.Transform(_, Text.From), "; "), type text})
in
    #"Extracted Values"

Regards,
Mariusz

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

aakashdmorya
Frequent Visitor

Re: Converting rows to columns in SharePoint Online List Report

@Mariusz  Thanks allot for your reply. But I have 2 datasource. This query will be applicable to which data source? Project or Tasks? Reply will be appriciated.

Super User IV
Super User IV

Re: Converting rows to columns in SharePoint Online List Report

Hi @aakashdmorya 

As you can see I have applied it to the merdged tables that you have listed third, however you copuld applie this to the Tasks table if you wich.

 

Hope this helps 
Mariusz 

aakashdmorya
Frequent Visitor

Re: Converting rows to columns in SharePoint Online List Report

Hi @Mariusz ,

 

I tried but it does not work at my end.

 

I have updated my question to include the PowerBI file also.

 

If you have any reference example or link you can share those.

 

Thank you

Super User IV
Super User IV

Re: Converting rows to columns in SharePoint Online List Report

Hi @aakashdmorya 

Please see the link to the pbix file below.
https://drive.google.com/file/d/1nyNdko2K-q5O1zan-P02b5jCKR9HMo1w/view?usp=sharing

 

Let me know if you expirience any problems
Mariusz

View solution in original post

aakashdmorya
Frequent Visitor

Re: Converting rows to columns in SharePoint Online List Report

Hi @Mariusz 

 

Thanks for your time and answer. That worked like charm and I am able to generate it to my report as well from SharePoint source. But I have one more additional comment.

 

Like you have combined the tasks together into one column but that all are actually a string concate. But what if I would like to add every task as a new column under "Tasks" header? Find reference below

 

Capture.PNG

 

Because I have to put the background color on each of the tasks based on its status. Again, any reference link will be helpful.

Helpful resources

Announcements
New Ranks Launched March 24th!

New Ranks Launched March 24th!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power BI Community!

‘Better Together’ Contest Finalists Announced!

‘Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Arun 'Triple A' Event Video, Q&A, and Slides

Arun 'Triple A' Event Video, Q&A, and Slides

Missed the Arun 'Triple A' event or want to revisit it? We've got you covered! Check out the video, Q&A, and slides now.

Join THE global Microsoft Power Platform event series.

Join THE global Power Platform event series.

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors