Hi barbieruelas,
The reason why we cannot select the Unit Group of the Unit as the filter when searching for Opportunity Line is because the relationship between Unit Group and Unit is "Do not Display", which cannot be changed.
In addition, there is no direct relationship between Opportunity Line and Unit Group, so we need to create this relationship for them first.
Solution:
New a lookup field "Unit Group" for Opportunity Line entity, select Target Record Type to Unit Group.
Then create two flows, one is to update the existing Opportunity Line records and only run once manually, the other is to update the new Opportunity Line records automatically.
1. The first flow:
In the Opportunity Line form, click Flow > Create a flow.
Then set the flow as follows.
Overview:
Detail:
The Unit Group in "Update a record" is the Unit Group in "Get record".
After saving the flow, go back to D365 Opportunity Line, refresh page, click Flow > the flow just created.
Wait for the flow to run finish. If successful, then turn off this flow.
In this way, all existing Opportunity Line's lookup field "Unit Group" should contain data.
2. The second flow:
In the power automate interface, go to Solutions, open a custom solution. If there is no custom solution, new it.
Then in the solution, new a flow.
Search for "common", select "When a record is created, updated or deleted".
Then set the flow as follows.
Overview:
Detail:
Create or update an Opportunity Line to test this flow.
In this way, the new Opportunity Line's lookup field "Unit Group" should contain data.
Finally, you are able to use the lookup field "Unit Group" in the report.