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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Anonymous
Not applicable

Help! Dax measure to add a column from another table with Many to Many relation.

Hello Guys,

 

I have 2 tables.

Table 1:

User ID    Shift

   

Table 2 :

USer ID

 

 

How do I add a shift column in table 2 with respect to each user ID's in Table 1?

 

THanks,

Anand!

1 ACCEPTED SOLUTION
sturlaws
Resident Rockstar
Resident Rockstar

Hi, @Anonymous ,

 

not much information you are providing here, so not possible to narrow down what would be the best approach for you.

 

If you have a relationship between the tables, you can look into the related-function, as long as it only returns one value.

 

Or you can use the lookupvalue-function

 

Or you can use something like this

column =
VAR _u2 =
    CALCULATE ( SELECTEDVALUE ( 'Table2'[UserID] ) )
RETURN
    CALCULATE (
        MAX ( 'Table1'[Shift] );
        FILTER ( ALL ( 'Table2' ); _u2 = 'Table1'[UserID] )
    )

 

Cheers,
Sturla

If this post helps, then please consider Accepting it as the solution. Kudos are nice too.

View solution in original post

2 REPLIES 2
v-eachen-msft
Community Support
Community Support

Hi @Anonymous ,

 

Could you please share your sample data and excepted result to me if you don't have any confidential Information. Please upload your files to One Drive and share the link here. I am not clear about your data type, it is difficult to give a correct solution.

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.
sturlaws
Resident Rockstar
Resident Rockstar

Hi, @Anonymous ,

 

not much information you are providing here, so not possible to narrow down what would be the best approach for you.

 

If you have a relationship between the tables, you can look into the related-function, as long as it only returns one value.

 

Or you can use the lookupvalue-function

 

Or you can use something like this

column =
VAR _u2 =
    CALCULATE ( SELECTEDVALUE ( 'Table2'[UserID] ) )
RETURN
    CALCULATE (
        MAX ( 'Table1'[Shift] );
        FILTER ( ALL ( 'Table2' ); _u2 = 'Table1'[UserID] )
    )

 

Cheers,
Sturla

If this post helps, then please consider Accepting it as the solution. Kudos are nice too.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Kudoed Authors