Forum Discussion

a68tbird's avatar
a68tbird
Icon for Resolver II rankResolver II
4 years ago
Solved

AverageIfs in DAX / LOOKUPVALUE

Hello All -   I'd like to add a calculated column to my Sales table (AllSales) that will return the relevant exchange rate.  The ExchangeRate table has daily rates, in four currencies.  What I would...
  • Greg_Deckler's avatar
    4 years ago

    a68tbird Try something like:

    Column = 
      VAR __Date = [salesDate]
      VAR __Year = YEAR(__Date)
      VAR __Month = MONTH(__Date)
    RETURN
      AVERAGEX(FILTER(ALL('ExchangeRates'),'ExchangeRates'[Year] = __Year && 'ExchangeRates'[ClosingMonth] = __Month),'ExchangeRates'[Rate])