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
rjose
Frequent Visitor

Get a column from another table

Hi,

I do have 2 tables with many to many relationship in my data model (connected using bridge table that is, a table containing unique values of column 'Category'). I want to get column 'Segment' from table 2 to table 1 where table1.category = table2.category && value between min AND max. Any idea on how to achieve this using DAX? Any help is highly appreciated.

 

Table 1

CategorySub categoryValue
aa110
aa220
aa330
bb140
bb250
bb360

Table 2

CategorySegmentMinMax
a<10010
a10-301030
a>303099999999
b<20020
b20-402040
b>404099999999

 

 

1 ACCEPTED SOLUTION
Samarth_18
Community Champion
Community Champion

HI @rjose ,

 

Create a column like below:-

 

Column =
CALCULATE (
    MAX ( _Table2[Segment] ),
    FILTER (
        ALL ( _Table2 ),
        [Category] = _Table1[Category]
            && ( [Value] > _Table2[Min]
            && [Value] <= _Table2[Max] )
    )
)

 

 

Output:-

Samarth_18_0-1645801816326.png

 

Note:- Please share the expected output if this is not matching with your expected output. 🙂

 

Thanks,

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

2 REPLIES 2
Samarth_18
Community Champion
Community Champion

HI @rjose ,

 

Create a column like below:-

 

Column =
CALCULATE (
    MAX ( _Table2[Segment] ),
    FILTER (
        ALL ( _Table2 ),
        [Category] = _Table1[Category]
            && ( [Value] > _Table2[Min]
            && [Value] <= _Table2[Max] )
    )
)

 

 

Output:-

Samarth_18_0-1645801816326.png

 

Note:- Please share the expected output if this is not matching with your expected output. 🙂

 

Thanks,

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

Thank you!

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.