I have 3 tables, the fist is the FactTable, the second is the Calendar table and the third is the DailyFx table, which lists the exchange rate for every single day of the year. I am trying to come up with a calculated column in the FactTable that for every row it will give me the average exchange rate for the given month (for example, this column will show the same number for every row in November 2015, the same number for every row in December 2015, and so on).
The Fact table has the following columns:
Date
Amount
The Daily Fx table has the following columns:
Date
Rate
The calendar table has the following columns:
Date
Month Name
I have an active relationship between the FactTable and the DailyFx table on the Date column and an inactive relationship on the Date column between the Calendar and DailyFx table.
This is the function that I have but it is not quite doing the job:
=
CALCULATE (
AVERAGE ( DailyFx[Rate] ),
ALL ( Calendar ),
FILTER (
Calendar,
DATESBETWEEN (
Calendar[Date],
EOMONTH ( FactTable[Date], 0 ),
EOMONTH ( FactTable[Date], -1 ) + 1
)
)
)
Please point me to the right direction. Thank you.
The Fact table has the following columns:
Date
Amount
The Daily Fx table has the following columns:
Date
Rate
The calendar table has the following columns:
Date
Month Name
I have an active relationship between the FactTable and the DailyFx table on the Date column and an inactive relationship on the Date column between the Calendar and DailyFx table.
This is the function that I have but it is not quite doing the job:
=
CALCULATE (
AVERAGE ( DailyFx[Rate] ),
ALL ( Calendar ),
FILTER (
Calendar,
DATESBETWEEN (
Calendar[Date],
EOMONTH ( FactTable[Date], 0 ),
EOMONTH ( FactTable[Date], -1 ) + 1
)
)
)
Please point me to the right direction. Thank you.