Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Exchange Rate Conversion with Date Range

Hey Everyone,  I need to convert the value of revenue (total_revenue_usd in finance table) into other currencies (exchange_rate table). If the transaction took place '6/1/2022', it must be conve...
  • johnt75's avatar
    4 years ago

    Try

    Converted Revenue =
    SUMX (
        'Finance query',
        VAR currentDate = 'Finance query'[day]
        VAR chosenCurrency = [Currency Selected]
        VAR exchRate =
            LOOKUPVALUE (
                exchange_rates_query[usd_exchange_rate],
                exchange_rates_query[name], chosenCurrency,
                exchange_rates_query[day], currentDate
            )
        RETURN
            'Finance query'[total_revenue_usd] * exchRate
    )