@Niels Søgaard Lønberg - I usually use the Advanced Find window to help me get started with the FetchXML, especially when ​joins are involved.
Within the Advanced Find window, there is a "Download FetchXML" button. And, as you can see, I have Opportunities and Activities "joined" using the "link-entity".

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true">
<entity name="opportunity">
<attribute name="name" />
<attribute name="customerid" />
<attribute name="estimatedvalue" />
<attribute name="statuscode" />
<attribute name="opportunityid" />
<order attribute="name" descending="false" />
<filter type="and">
<condition attribute="statecode" operator="eq" value="0" />
</filter>
<link-entity name="activitypointer" from="regardingobjectid" to="opportunityid" link-type="inner" alias="ab">
<filter type="and">
<condition attribute="statecode" operator="in">
<value>0</value>
<value>3</value>
</condition>
</filter>
</link-entity>
</entity>
</fetch>
------------------------------
Aaron Back, MCP
Sr. Microsoft Dynamics 365 Consultant
www.acemicrotech.com_______________________________________
CRMUG Board Member
CRMUG Chapter Leader - Cincinnati, Ohio
------------------------------
Original Message:
Sent: 07-05-2018 03:42 AM
From: Niels Lønberg
Subject: Deep query for sub-grid (activity roll-up)
Hi,
I'm trying to create a view to be used on a sub-grid. The sub-grid should contain a roll-up of all related activities:
My hierarchy looks like this. I would like to roll-up all activities regarding the Opportunities on the Parent Opportunity.

I've found a few blog posts on the topic, but I've not been able to find a solution that works.
I have created a view that shows all activities in the system. The FetchXML looks like this (I'm using FetchXML Builder in XrmToolBox):
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false" >
<entity name="activitypointer" >
<attribute name="subject" />
<attribute name="ownerid" />
<attribute name="prioritycode" />
<attribute name="regardingobjectid" />
<attribute name="activitytypecode" />
<attribute name="statecode" />
<attribute name="scheduledstart" />
<attribute name="scheduledend" />
<attribute name="instancetypecode" />
<attribute name="community" />
<order attribute="scheduledend" descending="false" />
<attribute name="activityid" />
</entity>
</fetch>
To my understanding, I now need to create link-entities between Parent Opportunity and Opportunity and between Opportunity and Activity. However, this is where the show stops right now.
I hope you can point me in the right direction.
------------------------------
BR,
Niels
------------------------------