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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
ljlmsd
Frequent Visitor

Is there a way make the inactive relationship active?

 WeChat Screenshot_20200609102543.png

Hi community,

 

I need your help! I am pretty new to the PBI, which is a very powerful tool.

 

I want to use the date table in the red circle as a slicer to control two main fact tables. But the relationship is inactive.

 

The two fact tables are basically the same with the same fields. Is there a way to achieve this? Or do I need to change the structure of the model?

 

Please shoot me a video if you have any recourses to teach how to structure the relations.

 

Thank you!

1 ACCEPTED SOLUTION

Make sure you have marked the Calendar table as your date table by right-clicking on it in the report view, then mark as date table. Then ensure that your date intelligence function is using that date as the [Dates] column for its work. It won't work if you use other dates in the model.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

9 REPLIES 9
mahoneypat
Microsoft Employee
Microsoft Employee

I agree you should rebuild your model, but in the short term you can use USERELATIONSHIP() inside a CALCULATE() expression to turn on a relationship.  See this article

https://docs.microsoft.com/en-us/dax/userelationship-function-dax

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


@mahoneypat correct me if I am wrong, but that won't affect slicer control will it? I guess it depends on what the measure and slicer are doing. I know I hit this issue a year or so ago and nothing but activating the relationship worked for the slicer, but I do not recall the specifics of what I was slicing - a DIM value or a calculation in a measure. 



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

You are right @edhans .  I was just answering the part about activating the relationship.  The model should be rebuilt, but TREATAS() could also be considered temporarily to pass filters around the model to get the desired effect.

Regards,

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


aj1973
Community Champion
Community Champion

Hi,

Is there a reason for having 2 Calendar Tables! wht don't use only one of them and you will be set.

 

Regards

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

edhans
Super User
Super User

You should really redo the model. There is rarely a need for 1:1 relationships, and quite a few bi-directional relationships, which even Microsoft recommends against as a rule. You are better off just merging the data in Power Query and having 1 table. You have a ton of 1:1 relationships where it looks like you brought in a lot of tables and loaded them. 

 

You want to try to create a star schema. The reason your relationship is inactive is you have ambiguity in your model because it is a big circle of tables related. The model multiple ways to get from table to table, and that is generally not a good thing. It disables relationships when that happens. 



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting
ljlmsd
Frequent Visitor

Hi Edhans,

 

Thank you for pointing it out! I feel the same way as you do. At first, I was trying to append the two similar tables and unpivot it.

 

But when I created a new measure to compare the value of this year and last year, I draw the measure and the date to the measure, nothing shows up. 

WeChat Screenshot_20200609110220.pngWeChat Screenshot_20200609110407.png

Do you know why this happen?

Make sure you have marked the Calendar table as your date table by right-clicking on it in the report view, then mark as date table. Then ensure that your date intelligence function is using that date as the [Dates] column for its work. It won't work if you use other dates in the model.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting
ljlmsd
Frequent Visitor

Thank you! 

 

Problem solved!

 

I really appreciate it!

Great @ljlmsd - I had to learn the hard way that the date intelligence stuff only works reliabily, or at all, with the magical date column in the date table.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 NL Carousel

Fabric Community Update - February 2025

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

Top Solution Authors
Top Kudoed Authors