Forum Discussion
Task with multiple resources showing as multiple rows in Power BI table; instead of just the one row
- Nov 15, 2024
SClark513This can be done in Power Query. However, depending upon the size of your dataset/tables performance may be a concern. How you include this in you model will vary, but the following will show you how to do it then you can determine what works in your model. Anyways, here is what you need to do.
.
Sorry for the formatting, but the new site would no allow me to post this with a number and/or bulleted list formatting.
Create a TaskRsrcList query using msdyn_resourceassignments, including only the msdyn_taskid and msdyn_bookableresourceid fields
Create RsrcLkpList query using the bookableresources, inlcuding only the msdyn_bookableresourceid and Resource name fields
Merge the TaskRsrcList and RsrcLkp tables on msdyn_bookableresourceid column
Go to Transform then click Group By.
In the Group By dialog box:
Select Group by msdyn_taskid
New column name: ResourceList
Operation: All Rows
Click OK.
Now, you will have a table grouped by ID with a nested table in the ResourceList column.
Next, you need to concatenate the resource values:
Add a Custom Column by going to the Add Column tab and clicking on Custom Column.
Name new column Concatenated Resources
In the Custom Column dialog box, enter the following formula:Text.Combine([ResourceList][Resource], ", ")
Click OK.
Remove the ResourceList column if you no longer need it
Incorporate this into your model as needed.
SClark513This can be done in Power Query. However, depending upon the size of your dataset/tables performance may be a concern. How you include this in you model will vary, but the following will show you how to do it then you can determine what works in your model. Anyways, here is what you need to do.
.
Sorry for the formatting, but the new site would no allow me to post this with a number and/or bulleted list formatting.
Create a TaskRsrcList query using msdyn_resourceassignments, including only the msdyn_taskid and msdyn_bookableresourceid fields
Create RsrcLkpList query using the bookableresources, inlcuding only the msdyn_bookableresourceid and Resource name fields
Merge the TaskRsrcList and RsrcLkp tables on msdyn_bookableresourceid column
Go to Transform then click Group By.
In the Group By dialog box:
Select Group by msdyn_taskid
New column name: ResourceList
Operation: All Rows
Click OK.
Now, you will have a table grouped by ID with a nested table in the ResourceList column.
Next, you need to concatenate the resource values:
Add a Custom Column by going to the Add Column tab and clicking on Custom Column.
Name new column Concatenated Resources
In the Custom Column dialog box, enter the following formula:
Text.Combine([ResourceList][Resource], ", ")
Click OK.
Remove the ResourceList column if you no longer need it
Incorporate this into your model as needed.
- SClark513Nov 19, 2024Copper Contributor
Thank you - this worked perfectly. I just had to rename my resource 'name' field as it was called 'name' for the concat part =
Table.AddColumn(#"Grouped Rows", "Concatenated Resources", each Text.Combine([ResourceList][name], ", "))
Appreciate you - thanks so much!