Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
aJayMitchell
Advocate II
Advocate II

RI Violations due to dimension only being relevant for some records - fix or leave?

I'm currently reviewing the metrics of a data model through DAX Studio, and noticed that a number of the dimension tables are flagging RI (referential integrity) violations.

 

These are being flagged due to not all rows in the fact table having related dimension values, and hence include null/blank. An example below where the two 'ZZ' rows don't have a 'Code' as it's not relevant for these types of transactions.

 

My question is, is it best practice to add a row into the dimension tables to account for the null/blank values, and resolve the RI violation, or is it such a minor issue that it is safe to leave it as is?

 

Dimension Table

CodeName
AAlpha
BBravo
CCharlie
DDelta

 

Fact Table

Row #AccountCode
1A123A
2A123B
3ZZ312 
4ZZ145 
5B234C
6C412C
1 ACCEPTED SOLUTION
otravers
Community Champion
Community Champion

It is best practice to ensure there's referential integrity in star schemas, Kimball makes a big deal out of it in the Data Warehouse Lifecycle. You'll want to add a "No Code" row in your dimension table as well as replace nulls in the fact table with the corresponding AccountCode key (you don't want nulls in your foreign key).

 

This best practice does translate to Power BI as assuming RI is in place generates simpler and faster SQL queries (INNER JOIN rather than LEFT OUTER JOIN).

https://docs.microsoft.com/en-us/power-bi/connect-data/desktop-assume-referential-integrity

------------------------------------------------
1. How to get your question answered quickly - good questions get good answers!
2. Learning how to fish > being spoon-fed without active thinking.
3. Please accept as a solution posts that resolve your questions.
------------------------------------------------
BI Blog: Datamarts | RLS/OLS | Dev Tools | Languages | Aggregations | XMLA/APIs | Field Parameters | Custom Visuals

View solution in original post

1 REPLY 1
otravers
Community Champion
Community Champion

It is best practice to ensure there's referential integrity in star schemas, Kimball makes a big deal out of it in the Data Warehouse Lifecycle. You'll want to add a "No Code" row in your dimension table as well as replace nulls in the fact table with the corresponding AccountCode key (you don't want nulls in your foreign key).

 

This best practice does translate to Power BI as assuming RI is in place generates simpler and faster SQL queries (INNER JOIN rather than LEFT OUTER JOIN).

https://docs.microsoft.com/en-us/power-bi/connect-data/desktop-assume-referential-integrity

------------------------------------------------
1. How to get your question answered quickly - good questions get good answers!
2. Learning how to fish > being spoon-fed without active thinking.
3. Please accept as a solution posts that resolve your questions.
------------------------------------------------
BI Blog: Datamarts | RLS/OLS | Dev Tools | Languages | Aggregations | XMLA/APIs | Field Parameters | Custom Visuals

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors