<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Midhun Balakrishnan</title>
    <description>The latest articles on DEV Community by Midhun Balakrishnan (@midhun_balakrishnan_7a34d).</description>
    <link>https://dev.to/midhun_balakrishnan_7a34d</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3919451%2F96af64ce-5674-40c3-bd0b-c75bb51d4dde.jpg</url>
      <title>DEV Community: Midhun Balakrishnan</title>
      <link>https://dev.to/midhun_balakrishnan_7a34d</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/midhun_balakrishnan_7a34d"/>
    <language>en</language>
    <item>
      <title>Understanding How Auto Relationship Detection and Auto Date/Time Impact Power BI Refresh in Dynamic Semantic Models</title>
      <dc:creator>Midhun Balakrishnan</dc:creator>
      <pubDate>Fri, 08 May 2026 07:28:26 +0000</pubDate>
      <link>https://dev.to/midhun_balakrishnan_7a34d/understanding-how-auto-relationship-detection-and-auto-datetime-impact-power-bi-refresh-in-dynamic-5elc</link>
      <guid>https://dev.to/midhun_balakrishnan_7a34d/understanding-how-auto-relationship-detection-and-auto-datetime-impact-power-bi-refresh-in-dynamic-5elc</guid>
      <description>&lt;p&gt;While working on a Power BI automation platform using TOM/XMLA and multiple datasources, I faced refresh failures that were difficult to identify initially.&lt;/p&gt;

&lt;p&gt;Our system dynamically generates tables and relationships at runtime using JSON metadata. However, the PBIX template already contained predefined relationships and Power BI automatic features such as:&lt;/p&gt;

&lt;p&gt;Auto relationship detection&lt;br&gt;
Auto date/time&lt;/p&gt;

&lt;p&gt;This created conflicts during refresh.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;Initially, the PBIX template assumed:&lt;/p&gt;

&lt;p&gt;Table1&lt;br&gt;
Col1 = relationship key&lt;/p&gt;

&lt;p&gt;But at runtime, the datasource generated:&lt;/p&gt;

&lt;p&gt;Table1&lt;br&gt;
Col2 = relationship key&lt;/p&gt;

&lt;p&gt;Even after updating relationships using TOM/XMLA during publishing, Power BI refresh still tried to validate relationships using older semantic assumptions from the PBIX template or automatically inferred metadata.&lt;/p&gt;

&lt;p&gt;This caused:&lt;/p&gt;

&lt;p&gt;relationship constraint errors&lt;br&gt;
refresh failures&lt;br&gt;
inconsistent semantic behavior&lt;/p&gt;

&lt;p&gt;Auto relationship detection made the issue worse because Power BI sometimes created implicit relationships automatically based on matching column names.&lt;/p&gt;

&lt;p&gt;Auto date/time also added hidden date tables and additional metadata, which increased model complexity in our dynamic schema environment.&lt;/p&gt;

&lt;p&gt;As a temporary workaround, I skipped rows causing constraint issues, but that led to incomplete data loading.&lt;/p&gt;

&lt;p&gt;Finally, the key learning was:&lt;/p&gt;

&lt;p&gt;Dynamic semantic models should avoid hidden or automatic semantic assumptions.&lt;/p&gt;

&lt;p&gt;The recommended approach is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;disable auto relationship detection&lt;/li&gt;
&lt;li&gt;disable auto date/time&lt;/li&gt;
&lt;li&gt;keep PBIX templates lightweight&lt;/li&gt;
&lt;li&gt;dynamically create relationships for runtime-controlled datasources&lt;/li&gt;
&lt;li&gt;retain only stable relationships for external datasources such as SharePoint or Excel&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This helped improve refresh stability and reduced semantic conflicts in dynamic Power BI models.&lt;/p&gt;

&lt;p&gt;Introduction&lt;/p&gt;

&lt;p&gt;While working on a dynamic Power BI report generation platform using TOM/XMLA and multi-datasource integration, I encountered a refresh issue that initially appeared to be related to relationship constraints and data integrity. However, after deeper analysis, the actual root cause was connected to Power BI automatic semantic modeling behaviors such as:&lt;/p&gt;

&lt;p&gt;Auto relationship detection&lt;br&gt;
Auto date/time generation&lt;br&gt;
Static PBIX semantic assumptions&lt;br&gt;
Dynamic runtime schema changes&lt;/p&gt;

&lt;p&gt;This article shares my understanding of the issue, the challenges faced, and the architectural learnings from handling dynamic semantic models in Power BI.&lt;/p&gt;

&lt;p&gt;Background&lt;/p&gt;

&lt;p&gt;Our platform supports multiple datasources:&lt;/p&gt;

&lt;p&gt;Internal Datasource&lt;/p&gt;

&lt;p&gt;The internal datasource provides metadata dynamically in JSON format, including:&lt;/p&gt;

&lt;p&gt;Tables&lt;br&gt;
Columns&lt;br&gt;
Relationships&lt;br&gt;
Row data&lt;br&gt;
Relationship keys&lt;/p&gt;

&lt;p&gt;The schema can change at runtime.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;Initial Schema&lt;br&gt;
Table1&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Col1 -&amp;gt; Relationship/Primary Key&lt;/li&gt;
&lt;li&gt;Col2&lt;/li&gt;
&lt;li&gt;Col3
Runtime Schema
Table1&lt;/li&gt;
&lt;li&gt;Col1&lt;/li&gt;
&lt;li&gt;Col2 -&amp;gt; Relationship/Primary Key&lt;/li&gt;
&lt;li&gt;Col3&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The effective relationship key changes dynamically.&lt;/p&gt;

&lt;p&gt;External Datasources&lt;/p&gt;

&lt;p&gt;We also support external datasources such as:&lt;/p&gt;

&lt;p&gt;SharePoint&lt;br&gt;
Excel&lt;br&gt;
Semi-structured external tables&lt;/p&gt;

&lt;p&gt;These datasources are comparatively less deterministic because:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;schemas may change&lt;/li&gt;
&lt;li&gt;data types may vary&lt;/li&gt;
&lt;li&gt;uniqueness is not guaranteed&lt;/li&gt;
&lt;li&gt;relationship inference is difficult&lt;/li&gt;
&lt;li&gt;Existing Architecture&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Initially, the PBIX template contained:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;predefined tables&lt;/li&gt;
&lt;li&gt;predefined relationships&lt;/li&gt;
&lt;li&gt;semantic metadata&lt;/li&gt;
&lt;li&gt;report visuals&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;At runtime:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;schema gets updated dynamically&lt;/li&gt;
&lt;li&gt;relationships are updated using TOM/XMLA&lt;/li&gt;
&lt;li&gt;semantic model is published&lt;/li&gt;
&lt;li&gt;refresh is triggered&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;At first glance, this appeared correct.&lt;/p&gt;

&lt;p&gt;However, refresh started failing with relationship constraint issues.&lt;/p&gt;

&lt;p&gt;The Actual Issue&lt;/p&gt;

&lt;p&gt;The problem was not only related to duplicate or blank values.&lt;/p&gt;

&lt;p&gt;The core issue was:&lt;/p&gt;

&lt;p&gt;Semantic mismatch between static PBIX relationship metadata and runtime-generated schema.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;PBIX Template Assumption&lt;br&gt;
Table1.Col1 = relationship key&lt;br&gt;
Runtime Datasource&lt;br&gt;
Table1.Col2 = relationship key&lt;/p&gt;

&lt;p&gt;Even though relationships were updated using TOM/XMLA during publishing, Power BI refresh processing still attempted to validate semantic relationships using stale or previously inferred metadata.&lt;/p&gt;

&lt;p&gt;As a result:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;refresh validated outdated key assumptions&lt;/li&gt;
&lt;li&gt;relationship constraints failed&lt;/li&gt;
&lt;li&gt;refresh processing became inconsistent&lt;/li&gt;
&lt;li&gt;How Auto Relationship Detection Made It Worse&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Power BI automatic relationship detection can silently create relationships based on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;matching column names&lt;/li&gt;
&lt;li&gt;inferred datatypes&lt;/li&gt;
&lt;li&gt;heuristic matching&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;Table1.Col1&lt;br&gt;
Table2.Col1&lt;/p&gt;

&lt;p&gt;Power BI may automatically create:&lt;/p&gt;

&lt;p&gt;Table1.Col1 ↔ Table2.Col1&lt;/p&gt;

&lt;p&gt;Even if runtime metadata intended:&lt;/p&gt;

&lt;p&gt;Table1.Col2 ↔ Table2.Col2&lt;/p&gt;

&lt;p&gt;In dynamic schema environments, this becomes dangerous because:&lt;/p&gt;

&lt;p&gt;hidden semantic assumptions get introduced&lt;br&gt;
runtime-generated relationships lose determinism&lt;br&gt;
unexpected joins appear&lt;br&gt;
stale relationship lineage remains&lt;br&gt;
refresh validation becomes unpredictable&lt;br&gt;
How Auto Date/Time Also Contributed&lt;/p&gt;

&lt;p&gt;Power BI Auto Date/Time creates:&lt;/p&gt;

&lt;p&gt;hidden local date tables&lt;br&gt;
implicit relationships&lt;br&gt;
hidden hierarchies&lt;br&gt;
additional semantic metadata&lt;/p&gt;

&lt;p&gt;For every detected datetime column.&lt;/p&gt;

&lt;p&gt;In static enterprise models this may be acceptable.&lt;/p&gt;

&lt;p&gt;But in dynamic runtime-generated models:&lt;/p&gt;

&lt;p&gt;datetime columns may change&lt;br&gt;
columns may disappear&lt;br&gt;
datatype may evolve&lt;br&gt;
runtime schema may not match PBIX assumptions&lt;/p&gt;

&lt;p&gt;This creates additional hidden metadata dependencies.&lt;/p&gt;

&lt;p&gt;As a result:&lt;/p&gt;

&lt;p&gt;refresh complexity increases&lt;br&gt;
semantic lineage becomes unstable&lt;br&gt;
hidden relationships may survive schema updates&lt;br&gt;
model debugging becomes harder&lt;br&gt;
Temporary Workaround&lt;/p&gt;

&lt;p&gt;As a mitigation, logic was added to:&lt;/p&gt;

&lt;p&gt;skip rows causing constraint violations&lt;br&gt;
avoid loading problematic records&lt;br&gt;
continue refresh execution&lt;/p&gt;

&lt;p&gt;However, this was only a temporary workaround because:&lt;/p&gt;

&lt;p&gt;data became partially loaded&lt;br&gt;
semantic inconsistency still existed&lt;br&gt;
stale relationship assumptions remained inside the model&lt;/p&gt;

&lt;p&gt;The root issue was not the rows themselves.&lt;/p&gt;

&lt;p&gt;The root issue was semantic mismatch.&lt;/p&gt;

&lt;p&gt;Architectural Learning&lt;/p&gt;

&lt;p&gt;The major realization was:&lt;/p&gt;

&lt;p&gt;Dynamic semantic models should avoid static semantic assumptions.&lt;/p&gt;

&lt;p&gt;Especially:&lt;/p&gt;

&lt;p&gt;predefined relationship keys&lt;br&gt;
auto-generated semantic metadata&lt;br&gt;
hidden inferred relationships&lt;br&gt;
implicit date hierarchies&lt;/p&gt;

&lt;p&gt;when schemas are runtime-driven.&lt;/p&gt;

&lt;p&gt;Recommended Approach&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Disable Auto Relationship Detection&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Recommended setting:&lt;/p&gt;

&lt;p&gt;File → Options → Current File → Data Load&lt;br&gt;
Disable:&lt;br&gt;
☐ Auto detect new relationships after data is loaded&lt;/p&gt;

&lt;p&gt;Reason:&lt;/p&gt;

&lt;p&gt;prevents implicit relationship generation&lt;br&gt;
keeps relationship orchestration deterministic&lt;br&gt;
gives full control to TOM/XMLA logic&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Disable Auto Date/Time&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Recommended setting:&lt;/p&gt;

&lt;p&gt;File → Options → Current File → Data Load&lt;br&gt;
Disable:&lt;br&gt;
☐ Auto date/time&lt;/p&gt;

&lt;p&gt;Reason:&lt;/p&gt;

&lt;p&gt;avoids hidden date tables&lt;br&gt;
reduces semantic model complexity&lt;br&gt;
improves metadata stability&lt;br&gt;
avoids hidden runtime dependencies&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Use Thin PBIX Templates&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;PBIX templates should mainly contain:&lt;/p&gt;

&lt;p&gt;report pages&lt;br&gt;
visuals&lt;br&gt;
themes&lt;br&gt;
formatting&lt;br&gt;
bookmarks&lt;/p&gt;

&lt;p&gt;Avoid embedding dynamic relationship assumptions.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Dynamically Generate Relationships for Runtime-Controlled Datasources&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For internally governed datasources:&lt;/p&gt;

&lt;p&gt;create relationships dynamically&lt;br&gt;
use runtime metadata&lt;br&gt;
validate schema before refresh&lt;br&gt;
use TOM/XMLA as source of truth&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Retain Stable Relationships for External Datasources&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For:&lt;/p&gt;

&lt;p&gt;SharePoint&lt;br&gt;
Excel&lt;br&gt;
external semi-structured sources&lt;/p&gt;

&lt;p&gt;retain only stable and carefully governed relationships.&lt;/p&gt;

&lt;p&gt;Because runtime inference for external sources is less deterministic.&lt;/p&gt;

&lt;p&gt;Final Understanding&lt;/p&gt;

&lt;p&gt;The issue was not a Power BI bug.&lt;/p&gt;

&lt;p&gt;It was an architectural conflict between:&lt;/p&gt;

&lt;p&gt;static PBIX semantic assumptions&lt;br&gt;
automatic Power BI semantic inference&lt;br&gt;
dynamic runtime-generated schemas&lt;/p&gt;

&lt;p&gt;The most important learning was:&lt;/p&gt;

&lt;p&gt;In dynamic semantic modeling systems, explicit semantic control is far safer than implicit automatic inference.&lt;/p&gt;

&lt;p&gt;Disabling automatic relationship detection and auto date/time significantly improves predictability, refresh stability, and semantic consistency in runtime-generated Power BI models.&lt;/p&gt;

&lt;p&gt;Conclusion&lt;/p&gt;

&lt;p&gt;Power BI works extremely well with stable semantic models and governed schemas.&lt;/p&gt;

&lt;p&gt;However, when building advanced runtime-driven semantic model automation platforms using:&lt;/p&gt;

&lt;p&gt;TOM/XMLA&lt;br&gt;
dynamic metadata&lt;br&gt;
runtime schema generation&lt;br&gt;
multi-datasource integration&lt;/p&gt;

&lt;p&gt;it becomes important to reduce hidden semantic assumptions inside PBIX templates.&lt;/p&gt;

&lt;p&gt;For dynamic architectures:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;deterministic relationship orchestration&lt;/li&gt;
&lt;li&gt;explicit semantic governance&lt;/li&gt;
&lt;li&gt;runtime-controlled schema validation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;become critical for stable refresh and semantic integrity.&lt;/p&gt;

&lt;p&gt;This experience helped me better understand how Power BI internally handles semantic metadata, relationships, and refresh validation in dynamic modeling scenarios.&lt;/p&gt;

</description>
      <category>powerbi</category>
      <category>businessintelligence</category>
    </item>
  </channel>
</rss>
