Forum Discussion
Annual Returns
- 8 years ago
Hi Anonymous
HOw abou this one?
YTD_Zubair = VAR Previous_YEAR_Closing = CALCULATE ( MAX ( EMCD[Date] ), EMCD[Date] < EARLIER ( EMCD[Date] ) && YEAR ( EMCD[Date] ) = YEAR ( EARLIER ( EMCD[Date] ) ) - 1 ) RETURN DIVIDE ( EMCD[Absalon EM Corporate Debt SICAV NAV], CALCULATE ( SUM ( EMCD[Absalon EM Corporate Debt SICAV NAV] ), EMCD[Date] = Previous_YEAR_Closing ) ) - 1
Hi Zubair,
Thanks so much for all your help, that worked just as I hoped. I now need to understand exactly how you have done it. The path to learning Dax is full of ups and downs!
Many thanks again.
Hi Anonymous,
Here's another solution
Monthly NAV opening
= if(ISBLANK(LASTNONBLANK(EMCD[Date],Sum(EMCD[Absalon EM Corporate Debt SICAV NAV]))),BLANK(),if(HASONEVALUE(DimDate[MonthsofYr]),Sum(EMCD[Absalon EM Corporate Debt SICAV NAV]),CALCULATE(Sum(EMCD[Absalon EM Corporate Debt SICAV NAV]),DATESBETWEEN(DimDate[Date],FIRSTNONBLANK(EMCD[Date],Sum(EMCD[Absalon EM Corporate Debt SICAV NAV])),EOMONTH(FIRSTNONBLANK(EMCD[Date],Sum(EMCD[Absalon EM Corporate Debt SICAV NAV])),0)))))
Monthly NAV closing
=if(ISBLANK(LASTNONBLANK(EMCD[Date],Sum(EMCD[Absalon EM Corporate Debt SICAV NAV]))),BLANK(),if(HASONEVALUE(DimDate[MonthsofYr]),Sum(EMCD[Absalon EM Corporate Debt SICAV NAV]),CALCULATE(Sum(EMCD[Absalon EM Corporate Debt SICAV NAV]),DATESBETWEEN(DimDate[Date],EOMONTH(LASTNONBLANK(EMCD[Date],Sum(EMCD[Absalon EM Corporate Debt SICAV NAV])),-1)+1,LASTNONBLANK(EMCD[Date],Sum(EMCD[Absalon EM Corporate Debt SICAV NAV]))))))
MonthlyRtn
= if(HASONEVALUE(DimDate[MonthsofYr]),IF(COUNTROWS(EMCD)>0, DIVIDE([MonthlyNAV opening],[PriorMonthNAV],BLANK())-1),if(ISBLANK([MonthlyNAV opening]),BLANK(),[MonthlyNAV closing]/[MonthlyNAV opening]-1))
- Anonymous8 years agoNot applicable
Hi Ashish,
Thanks. From the monthly NAV figure I am looking to calculate the cumulative yearly return which in 2015 would be 9613 /10000 -1. The calculation sadly doesn't match the correct answer I'm looking for. The Yearly figures in 2015 should be -3.86%, 2016 16.41%, YTD 2017 6.78% see attached spreadsheet which shows the calculation in excel https://1drv.ms/x/s!AiRs1BCuVWhM6FxhfrjpXpf5kU-H Also I should highlight that I am using a seperate date file and am not relying on the date in the EMCD model.
- Ashish_Mathur8 years agoSuper User