When measures are created in CI-D to be used in CI-J there are dependencies created which will stop you from removing the measure. CI-D is not very helpful in telling you how to remove it. I will try to be a bit more helpful.

When trying to remove the Measure this is the error I got:

Error: Detected DataVerse dependencies in Measure: ListMemberships. Please delete these dependencies and merge again.
Request ID: 14056846-b9c1-4ec8-98c2-88778e518b88
Time: 2024-12-05, 11:12:10

My investigation below with the help of Microsoft Support lead me to the understanding according to the image above. As you can see dependency is actually sort of circular, or at least one part of the dependency (dependent component) is at the entityanalytics on the record which points to msdynci_listmemberships, on the other hand (required component) on the table msdynci_listmemberships.

The fix, is to remove the record in entityanalytics. Easiest way in this case, is to just use a browser console where you are logged into the right Dynamics.

To remove the entityanalytics record that is blocking this:

Xrm.WebApi.deleteRecord('entityanalyticsconfig', 'fc105928-3170-ef11-a671-000d3a64e5b5')

After this I was able to remove the measure in CI-D.

Below I will detail the steps I did to understand this.

The first step is to look in the table “entityanalyticsconfig” searching for the name of the Measure. Its name is “msdynci_” + name of the measure. Check out the metadata if you are unsure.

<fetch top="50">
  <entity name="entityanalyticsconfig">
    <filter>
      <condition attribute="parententitylogicalname" operator="eq" value="msdynci_listmemberships" />
    </filter>
  </entity>
</fetch>
{
  "value": [
    {
      "isenabledforadls": true,
      "parententityid": "dd7613fe-806e-ef11-a670-000d3ad82e35",
      "modifiedon": "2024-09-11T11:29:54Z",
      "componentidunique": "807e7e6d-71f5-446a-8009-437cbf5a922a",
      "isenabledfortimeseries": false,
      "versionnumber": 15487568487,
      "parententitylogicalname": "msdynci_listmemberships",
      "entityanalyticsconfigid": "fc105928-3170-ef11-a671-000d3a64e5b5",
      "componentstate": 0,
      "organizationid": "ba0a9fa5-462b-45cc-b603-e9b16acd63c4",
      "solutionid": "fd140aae-4df4-11dd-bd17-0019b9312238"
    }
  ]
}

As you can see above the id is fc105928-3170-ef11-a671-000d3a64e5b5. This is the record I did the removal on above.

To further understand the dependency record for this, let’s dig into that table, searching for a record with this id.

<fetch top="50">
  <entity name="dependency">
    <attribute name="dependencyid" />
    <attribute name="dependencytype" />
    <filter>
      <condition entityname="dcn" attribute="objectid" operator="eq" value="fc105928-3170-ef11-a671-000d3a64e5b5" />
    </filter>
    <link-entity name="dependencynode" from="dependencynodeid" to="dependentcomponentnodeid" link-type="inner" alias="dcn">
      <attribute name="componenttype" />
      <attribute name="objectid" />
      <attribute name="parentid" />
    </link-entity>
    <link-entity name="dependencynode" from="dependencynodeid" to="requiredcomponentnodeid" link-type="inner" alias="rcn">
      <attribute name="componenttype" />
      <attribute name="objectid" />
      <attribute name="parentid" />
    </link-entity>
  </entity>
</fetch>
{
  "value": [
    {
      "rcn.componenttype": 1,
      "rcn.parentid": "00000000-0000-0000-0000-000000000000",
      "dcn.parentid": "00000000-0000-0000-0000-000000000000",
      "dcn.objectid": "fc105928-3170-ef11-a671-000d3a64e5b5",
      "dependencyid": "e46e52db-46a7-4585-8a6a-6ba888a5bd1f",
      "dcn.componenttype": 430,
      "rcn.objectid": "dd7613fe-806e-ef11-a670-000d3ad82e35",
      "dependencytype": 2
    }
  ]
}

The result shows us that the required component id is: dd7613fe-806e-ef11-a670-000d3ad82e35 which is of type: 1.

By checking this table in Microsoft Learn, we can see what this is: (both link and table)

By searching the table called “entity” for 430, we can find what table this represents:

https://learn.microsoft.com/en-us/power-apps/developer/data-platform/webapi/reference/dependency?view=dataverse-latest

ValuesLabel
1Entity
2Attribute
3Relationship
4Attribute Picklist Value
5Attribute Lookup Value
6View Attribute
7Localized Label
8Relationship Extra Condition
9Option Set
10Entity Relationship
11Entity Relationship Role
12Entity Relationship Relationships
13Managed Property
14Entity Key
16Privilege
17PrivilegeObjectTypeCode
20Role
21Role Privilege
22Display String
23Display String Map
24Form
25Organization
26Saved Query
29Workflow
31Report
32Report Entity
33Report Category
34Report Visibility
35Attachment
36Email Template
37Contract Template
38KB Article Template
39Mail Merge Template
44Duplicate Rule
45Duplicate Rule Condition
46Entity Map
47Attribute Map
48Ribbon Command
49Ribbon Context Group
50Ribbon Customization
52Ribbon Rule
53Ribbon Tab To Command Map
55Ribbon Diff
59Saved Query Visualization
60System Form
61Web Resource
62Site Map
63Connection Role
64Complex Control
70Field Security Profile
71Field Permission
90Plugin Type
91Plugin Assembly
92SDK Message Processing Step
93SDK Message Processing Step Image
95Service Endpoint
150Routing Rule
151Routing Rule Item
152SLA
153SLA Item
154Convert Rule
155Convert Rule Item
65Hierarchy Rule
161Mobile Offline Profile
162Mobile Offline Profile Item
165Similarity Rule
66Custom Control
68Custom Control Default Config
166Data Source Mapping
201SDKMessage
202SDKMessageFilter
203SdkMessagePair
204SdkMessageRequest
205SdkMessageRequestField
206SdkMessageResponse
207SdkMessageResponseField
210WebWizard
18Index
208Import Map
300Canvas App
371Connector
372Connector
380Environment Variable Definition
381Environment Variable Value
400AI Project Type
401AI Project
402AI Configuration
430Entity Analytics Configuration
431Attribute Image Configuration
432Entity Image Configuration
<fetch top="50">
  <entity name="entity">
    <attribute name="logicalname" />
    <filter>
      <condition attribute="entityid" operator="eq" value="dd7613fe-806e-ef11-a670-000d3ad82e35" />
    </filter>
  </entity>
</fetch>
{
  "value": [
    {
      "logicalname": "msdynci_listmemberships",
      "entityid": "dd7613fe-806e-ef11-a670-000d3ad82e35"
    }
  ]
}

Hence, from this I generated the image above. Since it is something of a circular reference, Microsoft Support suggested that I remove the entity analytics record with id: e46e52db-46a7-4585-8a6a-6ba888a5bd1f. However, not entirely sure what this is and hence I tried the one I had gotten in the first steps above, and that worked.

Generally I think it is a good idea to investigate what the dependencies point to, before removing something. In this case the dependency record in itself wasn’t removed, only the dependent part.

Thanks to Microsoft support for helping out with this and I hope it might shed some insights if you are having similar issues. I also think breaking down the dependency table in a tool in for instance XrmToolBox would be a great idea. I have a bit of a bad conscience for BulkDeleteManager that I own and I am not giving enough love, so feel free to build it based on this and I guess some more stuff. I will be happy to help out the the investigations if you are willing to build it.