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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Gabiiiii
Frequent Visitor

How to add a column from another table with inactive relationship

There are 2 tables in this particular case and they have an inactive 1-m relationship. (because the data model are more complicated, cannot make the relationship active)

 

The fact table looks like this:

Gabiiiii_2-1654675855063.png

The dimention table(Business Unit) is like this:

Gabiiiii_1-1654675790952.png

 

I want to add BU_name into the fact table accordingly, and I use:

CALCULATE(LASTNONBLANK(BusinessUnit[BU_name],BusinessUnit[BU_name]),USERELATIONSHIP(Fact_table[BU_id],BusinessUnit[BU_id]))
but it returns the wrong value. 
 
Can someone help with this problem? Thank you so much!!

 

 

1 ACCEPTED SOLUTION
Samarth_18
Community Champion
Community Champion

Hi @Gabiiiii ,

 

Create a column as below:-

Column =
CALCULATE (
    LASTNONBLANK ( Dim[BU_name], Dim[BU_name] ),
    FILTER ( Dim, 'Fact'[BU_id] = Dim[BU_id] ),
    USERELATIONSHIP ( 'Fact'[BU_id], Dim[BU_id] )
)

BR,

Samarth

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Lookupvalue() can also be used in this case which does not depend on relationships in the model.
Column = 
LOOKUPVALUE( Dim[BU_name],Dim[BU_id],fact[BU_id])

Samarth_18
Community Champion
Community Champion

Hi @Gabiiiii ,

 

Create a column as below:-

Column =
CALCULATE (
    LASTNONBLANK ( Dim[BU_name], Dim[BU_name] ),
    FILTER ( Dim, 'Fact'[BU_id] = Dim[BU_id] ),
    USERELATIONSHIP ( 'Fact'[BU_id], Dim[BU_id] )
)

BR,

Samarth

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Anonymous
Not applicable

Same situation in my data.
There is an inactive relationship between two tables and I cant make it active. Because data is complicated.
I want to pull 2 columns from Table B to Table A.
There is a Customer code column for the primary key.

But your solution doesn't work there.

 

I think most people assume that FILTER is automatically applied as the relationship was set though its inactive.

 

Thanks Samrath, after adding the FILTER, i am getting the correct value.

Thank you Samarth!

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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