Forum Discussion

CJensen's avatar
CJensen
Helper I
6 years ago
Solved

Getting currency from another table

Hi  I have a bit of a problem, that I cant solve myself.   I have a salestable with sales but no exchange rate in that table. I have the currency in anothertable, but I cant seem to retrieve the...
  • v-lid-msft's avatar
    v-lid-msft
    6 years ago

    Hi CJensen ,

     

    In your sample, we cannot get anything by Vlookup function  as there is no matching rows in both tables. So We can create calculated column using following DAX.

     

    ExchangeRate =
    VAR cu = [Currency]
    VAR t =
        FILTER (
            ALL ( ExchangeRates ),
            AND (
                [Posting Date] >= ExchangeRates[FROMDATE],
                [Posting Date] <= ExchangeRates[LASTCHANGED]
            )
        )
    VAR result =
        FILTER ( t, [Currency] = cu )
    RETURN
        MAXX ( result, [EXCHRATE] )

     

    But I do not know what time column you want to use in sales table, so I use positon date in your DAX to do this example.

     

    BTW, pbix as attached.

     

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