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! Learn more

Reply
Anonymous
Not applicable

Best way to use a Date value from one table to look up another table's Date range value?

Hi,

I have TableA that contains multiple columns. One of these columns is a Date column (i.e. 11/02/2017).

 

I would like to use this single Data column's value to look up against, the below, TableB and select the column A value.

table.PNG

 

For example,

The Date chosen from TableA is '11/02/2017'. I would like to look up the 'MPB Meeting Date' in TableB and it's active date range, and then select the TableB's columnn A value.

So for the TableA date of 11/02/2017 the return value is 'January 2017 MPB'.

 

What is the best way to do this?  Is there a DAX way, or would I have have to populate a Date table column to hold every date through the year with an additional column stating 'January 2017 MPB' so it can look up against?

With the latter, TableB may often change and therefore the date ranges will need updating often.

 

I have rushed this question (apologies) but I hope it makes sense on what I'm trying to achieve.

Thanks.

1 ACCEPTED SOLUTION
v-ljerr-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

 

If I understand you correctly, you should be able to use the formula below to create a measure to get the expected result in your scenario. Smiley Happy

measure =
VAR selectedDateFromTableA =
    MAX ( TableA[Date] )
RETURN
    CALCULATE (
        FIRSTNONBLANK ( TableB[ColumnA], 1 ),
        FILTER (
            TableB,
            TableB[Start date period] <= selectedDateFromTableA
                && TableB[MPB Meeting Date] >= selectedDateFromTableA
        )
    )

 

Regards

View solution in original post

1 REPLY 1
v-ljerr-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

 

If I understand you correctly, you should be able to use the formula below to create a measure to get the expected result in your scenario. Smiley Happy

measure =
VAR selectedDateFromTableA =
    MAX ( TableA[Date] )
RETURN
    CALCULATE (
        FIRSTNONBLANK ( TableB[ColumnA], 1 ),
        FILTER (
            TableB,
            TableB[Start date period] <= selectedDateFromTableA
                && TableB[MPB Meeting Date] >= selectedDateFromTableA
        )
    )

 

Regards

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