cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
SaudMeethal Regular Visitor
Regular Visitor

Lookup to access a value within two dates

 

Hi,

 

I have a currency rate master of the exchange rates for a specific time period. The time period is defined by the "To Date" and the "From Date".

 

There is another table with Job details including their billing amount and billing currency.  I need to access the respective rate for the respective currency in each row in the job table and store in an "exchange_rate" column in job table.

 

I have tried the following approach:

 

CurrencyRate = CALCULATE(VALUES(CurrencyMaster[Rate]),FILTER(CurrencyMaster,CurrencyMaster[Currency Name] = Job[Billing Currency]),FILTER(CurrencyMaster,Job[Job Created Date]<= CurrencyMaster[To Date] && Job[Job Created Date]>=CurrencyMaster[From Date]))

 

But i'm getting the following error:

A table of multiple values was supplied where a single value was expected.

Not sure whether the approach is correct. Any suggesstions?

 

Sample Data

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Lookup to access a value within two dates

Hi @SaudMeethal,

 

The VALUES returns a table. That's the cause of the error. Try this one, please. If there are blank values, you could know there is something wrong. For example, there are two lines in the same period.

 

Column =
CALCULATE (
    SELECTEDVALUE ( CurrencyMaster[Rate] ),
    FILTER (
        CurrencyMaster,
        CurrencyMaster[From Date] <= [Job Created Date]
            && CurrencyMaster[To Date] >= [Job Created Date]
            && CurrencyMaster[Currency Name] = Job[Billing Currency]
            && CurrencyMaster[Status] = "Active"
    )
)

 

 

Best Regards,

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
1 REPLY 1
Community Support Team
Community Support Team

Re: Lookup to access a value within two dates

Hi @SaudMeethal,

 

The VALUES returns a table. That's the cause of the error. Try this one, please. If there are blank values, you could know there is something wrong. For example, there are two lines in the same period.

 

Column =
CALCULATE (
    SELECTEDVALUE ( CurrencyMaster[Rate] ),
    FILTER (
        CurrencyMaster,
        CurrencyMaster[From Date] <= [Job Created Date]
            && CurrencyMaster[To Date] >= [Job Created Date]
            && CurrencyMaster[Currency Name] = Job[Billing Currency]
            && CurrencyMaster[Status] = "Active"
    )
)

 

 

Best Regards,

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.