I'm trying to use the DAX Time Intelligence Functions in a Tabular Model in Analysis Services in Visual Studio 2017.
I have the following calculation requirements:
- Date (DateTime)
- Monthly Performance (in percentage)
- Account
For each account, we would like to calculate the YTD, 1Y, 2Y, 3M, 5M Performance metrics...
using the following performance formula:
Perf for 3M =
(1 + CurrentMonthPerf/100)*(1 + PriorMonth/100)*(1 + PriorPriorMonth/100) - 1
Perf for 1Y =
(1 + CurrentMonthPerf/100)*(1 + {1MonthAgoPerf}/100)*...* (1 + {12MonthsAgoPerf}/100) - 1
Perf for YTD = Same calculation as above but only for the months from Jan till Current table cell. Each row will calculate the Product in a loop: (1 + X)...(1 + Y)) - 1
I'm new to DAX syntax so unsure how to perform this calculation using DAX in SSDT 2017.
Please advise how I can perform more complex date calculations.