Forum Discussion

slatka11's avatar
slatka11
Helper I
3 years ago
Solved

Lookup value if date falls between 2 dates

I have the two below tables, one with invoice dates and the other with exchange rate date ranges, which I am trying to lookup the exchange rate based on if the invoice date falls within a date range:...
  • FreemanZ's avatar
    FreemanZ
    3 years ago

    Hi slatka11 

    Sorry, there are some misconderations.  Now this:

    1) create a measure with this:

     

    Rate = 
    VAR _date = MAX(Table1[InvoiceDate])
    RETURN
    MINX(
        FILTER(
            Table2,
            Table2[StartDate]<=_date
                 && Table2[EndDate]>=_date
         ),
    Table2[ExchRate]
    )

     

    2) plot a table with the measure and the [InvoiceDate] column. 

     

    I tried and it worked like this: