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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
swwong1
Helper III
Helper III

Do inactive relationships affect DAX?

Hi All

 

I have created a 10-day rolling revenue DAX measure and I have a query about the blank row on the matrix. I have asked the online instructor from my course and they have replied "Power BI doesn't recognize the first date as a termination point and therefore continue the calculation one more day. "

 

However, when I remove the inactive relationship (between date table and the shipped date), the blank row is gone. So, it seems like the inactive relationship is causing the issue as the ship date does have dates before 1/1/2015 while all transactions are on 1/1/2015 or after.

 

My question is, am I correct to say the inactive relationship does affect the DAX results?

 

Many thanks!!

 

https://www.dropbox.com/s/p43xpwn7hmax2ec/Inactive%20Relationship.pbix?dl=0 

 

1 ACCEPTED SOLUTION
swwong1
Helper III
Helper III

Hi All

 

Was reading about inactive relationships and they mentioned something about table expansion where a left outer join is used from the many-to-one side of the tables; including inactive relationships. If the "many" to the "one" side doesn't exist, a blank virtual row is added to the "one" side table.

 

Based on the above, as my "many" side (stock date) to the "one" side doesn't exist, a blank row was created in the "one side" which probably explains why there is a blank row before 1/1/2015. I guess it isn't really due to DAX but this behavior was shown when using one of the DAX formulas.

 

Link is below (3/4 of the page on the above point):

https://docs.microsoft.com/en-us/power-bi/transform-model/desktop-relationships-understand

View solution in original post

6 REPLIES 6
swwong1
Helper III
Helper III

Hi All

 

Was reading about inactive relationships and they mentioned something about table expansion where a left outer join is used from the many-to-one side of the tables; including inactive relationships. If the "many" to the "one" side doesn't exist, a blank virtual row is added to the "one" side table.

 

Based on the above, as my "many" side (stock date) to the "one" side doesn't exist, a blank row was created in the "one side" which probably explains why there is a blank row before 1/1/2015. I guess it isn't really due to DAX but this behavior was shown when using one of the DAX formulas.

 

Link is below (3/4 of the page on the above point):

https://docs.microsoft.com/en-us/power-bi/transform-model/desktop-relationships-understand

v-yingjl
Community Support
Community Support

Hi @swwong1 ,

When using time-intelligence-functions like datesinperiod(), it needs a whole date dimension table to detect the context .

In your data dimension table, it seems only have order dates not included all dates like stockDate. I think there is no relationship between inactive realationship and dax expression. With your date table, those measure cannot detect the right context of the table so that you will get some blank rows. When using calendarauto() as @AllisonKennedy  mentioned to create a date dimension table, it seems work fine.

 

Best Regards,
Yingjie Li

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

Thanks @AllisonKennedy@Greg_Deckler 

 

Hi @v-yingjl

 

What I am confused about is if I remove the inactive relationship (dotted line) under the model tab, the blank row in the matrix disappears; therefore this means the inactive relationship is causing the blank row???

 

I would expect the empty row if I have an active relationship between stockdate and date table as stockdate have dates before 1/1/2015 while my calendar table only starts from 1/1/2015.

Thanks

AllisonKennedy
Super User
Super User

That is interesting. A couple of things I noticed in your model: 

A) Stock date is text data type - should be date to match with the Date table via inactive relationship

B) Date table does not contain all the dates for Stock date column, so this is why the 'blank' is coming through

 

I'm still not sure why it's doing so with an inactive relationship, call it a feature? As @Greg_Deckler suggested, contact support. When I try the same visual using CALENDARAUTO in your sample file (so date table contains all dates in stock date and order date), the DAX behaves as expected with or without the inactive relationship. 

 

Has this post solved your problem? Please mark it as a solution so that others can find it quickly and to let the community know your problem has been solved. 

 

If you found this post helpful, please give Kudos.

I work as a trainer and consultant for Microsoft 365, specialising in Power BI and Power Query. 

https://sites.google.com/site/allisonkennedycv


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Greg_Deckler
Super User
Super User

@swwong1 - That is really, really interesting. Before taking a look at your PBIX file I would have said no, that they do not. But, I can't explain this behavior otherwise. It's actually really odd. You might want to post this as an issue.

https://aka.ms/PBI_Comm_Issues


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
amitchandak
Super User
Super User

The information you have provided is not making the problem clear to me. Can you please explain with an example.

Appreciate your Kudos.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.