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
Anonymous
Not applicable

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
v-jiascu-msft
Employee
Employee

Hi @Anonymous,

 

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.

View solution in original post

1 REPLY 1
v-jiascu-msft
Employee
Employee

Hi @Anonymous,

 

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.

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.