Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Answered

Connection entity Record1 and Record2 entities

(5) ShareShare
ReportReport
Posted on by 10
I am currently looking at the Connection entity because I am working on a report in Power BI. I just want to quickly check if my understanding is correct. But the way I view it, connections don't have a set direction, right? What I mean is that, if we are for example talking about a connection between, say, the Opportunity and the Contact table, it could be that this is reflected in the connection table as either Record1 being the Opportunity and Record2 being the Contact OR Record1 being the Contact and Record2 being the opportunity. Basically depending on which way around the connection was created in D365 by the users is also reflected in the data, correct?
 
Assuming this understanding of the data is correct, is there a best practice how to ensure that the data from the connection table is only working in one direction? Would I have to clean my data after I pull it from D365 in such a way so that record1 is always the opportunity entity? Or is there a different way where I don't have the flipped entity issue?
  • Verified answer
    Daivat Vartak (v-9davar) Profile Picture
    6,062 Super User 2025 Season 1 on at
    Connection entity Record1 and Record2 entities
    Hello HO-26030904-0,
     

    You've hit on a critical point about the Dynamics 365 Connection entity: it's indeed directionless. Your understanding is absolutely correct.

    Understanding the Connection Entity:

    • No Inherent Direction: The Connection entity is designed to represent a general association between two records. It doesn't inherently imply a "from" or "to" relationship.
    • Record1 and Record2: The Record1 and Record2 fields simply hold references to the two connected records. The order in which they're populated depends on the user's action when creating the connection.
    • Flexibility: This design provides flexibility for representing various types of relationships, but it introduces complexity when analyzing the data.

    •  

    Addressing the Directionality Challenge in Power BI:

    You're right that you'll need to handle the directionality issue in your Power BI reporting. Here's a breakdown of best practices and approaches:

    1. Data Transformation in Power Query (Recommended):

    • Create a "Standardized" Direction:

      • In Power Query, add a custom column to your Connection table.
      • Use conditional logic (e.g., if...then...else) to determine the "standard" direction you want to enforce.
      • For example, you could say, "If Record1 is an Opportunity, then keep it as Record1; otherwise, swap Record1 and Record2."
      • Create new columns for standardized Record1 and Record2, and then delete the old Record1 and Record2 columns. 

    • Example Power Query Code:
       
    • = Table.AddColumn(#"Previous Step", "StandardizedRecord1", each if [Record1Type] = "opportunity" then [Record1] else [Record2]),
      = Table.AddColumn(#"Added StandardizedRecord1", "StandardizedRecord2", each if [Record1Type] = "opportunity" then [Record2] else [Record1]),
      = Table.RemoveColumns(#"Added StandardizedRecord2",{"Record1", "Record2"})

      • You will need to add an additional column, that contains the record type of record 1 and record 2.
      • This ensures that all Opportunity-Contact connections are represented with the Opportunity in the "StandardizedRecord1" column. 

    • Benefits:

      • Centralized data transformation.
      • Ensures consistency across your reports.
      • Improves performance by reducing data manipulation in DAX. 

    •  

    2. DAX Measures (Less Ideal for Large Datasets):

    • Conditional Logic in Measures:

      • You could use DAX measures to apply conditional logic when calculating values or creating relationships.
      • However, this approach can be less efficient for large datasets, as DAX calculations are performed at query time. 

    • Drawbacks:

      • Performance impact.
      • Increased complexity of DAX measures.
      • Data inconsistency if not implemented carefully. 

      •  

    3. View Creation in Dynamics 365 (If Possible):

    • Create a View:

      • If possible, create a custom view in Dynamics 365 that enforces the desired directionality.
      • This view could use similar conditional logic to the Power Query approach. 

    • Limitations:

      • Dynamics 365 view creation might have limitations on complex logic.
      • Might not be feasible for all scenarios. 

      •  

    Best Practices:

    • Power Query Transformation:

      • The Power Query approach is generally the best practice for handling directionality in the Connection entity.
      • It ensures data consistency and improves performance. 

    • Standardize Record Types:

      • Create columns that identify the record types of Record1 and Record2. This will make it easier to apply conditional logic. 

    • Document Your Logic:

      • Clearly document the logic you use to standardize the direction of your connections. This will help with maintenance and troubleshooting. 

    • Test Thoroughly:

      • Thoroughly test your Power Query transformations to ensure they produce the desired results.

      •  

    •  

    By following these best practices, you can effectively address the directionality challenge of the Connection entity in Power BI and create accurate and consistent reports.

     
    If my answer was helpful, please click Like, and if it solved your problem, please mark it as verified to help other community members find more. If you have further questions, please feel free to contact me.
     
    My response was crafted with AI assistance and tailored to provide detailed and actionable guidance for your Microsoft Dynamics 365 query.
     
    Regards,
    Daivat Vartak

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,141 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,892 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Product updates

Dynamics 365 release plans