# Combine Two Different Objects

**URL:** <https://forums.powershell.org/t/combine-two-different-objects/13250>\
**Category:** PowerShell Help\
**Created:** [October 8, 2019, 7:42am UTC](https://forums.powershell.org/t/combine-two-different-objects/13250 "2019-10-08T07:42:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![anelliaf](https://avatars.discourse-cdn.com/v4/letter/a/cab0a1/32.png) [@anelliaf](https://forums.powershell.org/u/anelliaf)\
**Post date:** [October 8, 2019, 7:42am UTC](https://forums.powershell.org/t/combine-two-different-objects/13250/1 "2019-10-08T07:42:10Z")

</div>

Hello,

I’m looking to combine/match results from two different object sets. The first one is from ‘Get-PowerBIReport’ has the following output:

[pre]

Id : 12573cbf-77ab-42c4-b915-6  
Name : PBPhone  
WebUrl : [Power BI Sign in](https://app.powerbi.com/reports/12573cbf-77ab-42c4-b915-6)  
EmbedUrl : [Microsoft Power BI](https://app.powerbi.com/reportEmbed?reportId=12573cbf-77ab-42c4-b915-6762bf51cfab&amp;config=ey)  
XJsIjoiaHR0cHM6Ly9XQUJJLVVTLUVBU1QyLXJlZGlyZWN0LmFuYWx5c2lzLndpbmRvd3MubmV0In0%3d  
DatasetId : 971a8a6e-f465-4e42-b2b8

[/pre]

The other is from ‘Get-PowerBIDataset’ and has the following output:

[pre]

Id : 29a26268-8b33-4de5-be90-63  
Name : server\_count\_example  
ConfiguredBy :  
DefaultRetentionPolicy :  
AddRowsApiEnabled : False  
Tables :  
WebUrl :  
Relationships :  
Datasources :  
DefaultMode :  
IsRefreshable : True  
IsEffectiveIdentityRequired : False  
IsEffectiveIdentityRolesRequired : False  
IsOnPremGatewayRequired : True

[/pre]

Is there anyway to match the results? I’d also like to add a third object from a different get statement.

Thanks,

Frank

---

<div class="post-metadata">

**Author:** ![rob-simmers](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/rob-simmers/32/1010_2.png) [@rob-simmers](https://forums.powershell.org/u/rob-simmers)\
**Post date:** [October 8, 2019, 9:26am UTC](https://forums.powershell.org/t/combine-two-different-objects/13250/2 "2019-10-08T09:26:41Z")

</div>

Take a look: [Executing LINQ Queries in PowerShell – Part 2 – PowerShell.org](https://powershell.org/2018/05/executing-linq-queries-in-powershell-part-2/)

---

<div class="post-metadata">

**Author:** ![anelliaf](https://avatars.discourse-cdn.com/v4/letter/a/cab0a1/32.png) [@anelliaf](https://forums.powershell.org/u/anelliaf)\
**Post date:** [October 9, 2019, 5:49am UTC](https://forums.powershell.org/t/combine-two-different-objects/13250/3 "2019-10-09T05:49:56Z")

</div>

I tried something similar, but not quite the linq query. I created an empty array to collect the objects, but I still seem to be missing data.

[pre]  
$outputCollection = @()  
$reports = Get-PowerBIReport -Scope Organization  
$datasets = Get-PowerBIDataset -Scope Organization

$reports | Foreach-Object {  
#Associate objects  
$reportObject = $reports  
$datasetObject = $datasets | Where-Object {$\_.Id -eq $reportObject.Id}

```
#Make a combined object
$outputObject = "" | Select Name, ConfiguredBy, MailboxAttribute
$outputObject.Name = $reportObject.Name
$outputObject.ConfiguredBy = $reportObject.ConfiguredBy
$outputObject.ID = $datasetObject.Id

#Add the object to the collection
$outputCollection += $outputObject

```

}

$outputCollection  
[/pre]

The output:

[pre]

Name : {Dashboard Usage Metrics Report, Office 365 Adoption Preview, Office 365  
Adoption Preview, Microsoft Azure Consumption Insights…}  
ConfiguredBy :  
ID:

[/pre]

I’m still missing the link between reports and datasets?

Thanks,  
Frank

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:31pm UTC](https://forums.powershell.org/t/combine-two-different-objects/13250/4 "2024-05-16T20:31:18Z")

</div>


