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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request 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
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors