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

How to get the Column value from one table to another comparing on date ranges

Hi, Can some one help on how to get the Column value from one table to another comparing on date ranges and there is no relationship between these two table. For example there are two different tables which should look like below

 

TABLE_A - 

UIDStart_DateEnd_Date
ID00112/17/201712/30/2017
ID00212/31/20171/13/2017
ID0031/14/20181/27/2018
ID0041/28/201810/2/2018
ID00511/2/20182/24/2018

 

TABLE_B

Date
1/15/2018
1/1/2016
12/30/2017
1/1/2016
1/1/2016

 

 

Also I came accross with this solution article but it is for measure value, I am confused now and not sure if I am missing something

(https://community.powerbi.com/t5/Desktop/Best-way-to-use-a-Date-value-from-one-table-to-look-up-anot...)

 

Requirement/Expected results should look like this:

DateDAX COLUMN (Please IGONRE this column, this is just for refernce)
1/15/2018ID003This date falls between TABLE_A record 3
1/1/2016  
12/30/2017ID001This matches record 1 on TABLE_A and fetches the UID
1/1/2016  
1/1/2016  
3 ACCEPTED SOLUTIONS
Zubair_Muhammad
Community Champion
Community Champion

@Anonymous

 

Try this column

 

DAX Column =
CALCULATE (
    FIRSTNONBLANK ( Table_A[UID], 1 ),
    FILTER (
        Table_A,
        Table_A[Start_Date] <= Table_B[Date]
            && Table_A[End_Date] >= Table_B[Date]
    )
)

View solution in original post

@Anonymous

 

Another way . This is more appropriate... in case you might have more than one ID for a date

 

Dax Column =
CONCATENATEX (
    FILTER (
        Table_A,
        Table_A[Start_Date] <= Table_B[Date]
            && Table_A[End_Date] >= Table_B[Date]
    ),
    Table_A[UID],
    ", "
)

View solution in original post

Anonymous
Not applicable

@Zubair_Muhammad Awsome! Appreciate your quick response and also providing appropriate suggestions with multiple options. For me currently there are no multiple IDs and the 1st solution worked like charm, but 2nd one is a good start for me to impliment best standards and a learnign too.

 

Thanks!

 

 

View solution in original post

4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi @Anonymous,

 

There could be another way of solving it.  Please confirm if you will have duplicate date entries in Table B.  You have show the second last one being repeated in Table B.  Can that actually be the case?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

@Zubair_Muhammad Awsome! Appreciate your quick response and also providing appropriate suggestions with multiple options. For me currently there are no multiple IDs and the 1st solution worked like charm, but 2nd one is a good start for me to impliment best standards and a learnign too.

 

Thanks!

 

 

Zubair_Muhammad
Community Champion
Community Champion

@Anonymous

 

Try this column

 

DAX Column =
CALCULATE (
    FIRSTNONBLANK ( Table_A[UID], 1 ),
    FILTER (
        Table_A,
        Table_A[Start_Date] <= Table_B[Date]
            && Table_A[End_Date] >= Table_B[Date]
    )
)

@Anonymous

 

Another way . This is more appropriate... in case you might have more than one ID for a date

 

Dax Column =
CONCATENATEX (
    FILTER (
        Table_A,
        Table_A[Start_Date] <= Table_B[Date]
            && Table_A[End_Date] >= Table_B[Date]
    ),
    Table_A[UID],
    ", "
)

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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