Forum Discussion
Anonymous
7 years agoNot applicable
get value by Category using STARTOFYEAR
Dear, I'm trying to calculate the annual profitability of IndexKey 2, using the most recent value and the first value of the year. But the variable StartValue is ignoring the filter (FatIndexHistori...
Ashish_Mathur
Super User
7 years agoHi,
So for IndexKey 2, you are expecting the answers to be 92031.86 and 91840.8. Am i correct? Share the link from where i can downlod your PBI file.
- Anonymous7 years agoNot applicable
Ashish_Mathur wrote:Hi,
So for IndexKey 2, you are expecting the answers to be 92031.86 and 91840.8. Am i correct? Share the link from where i can downlod your PBI file.
Ashish_Mathur ,
You are right, see the link below:
Index.pbixThank you for aswering.
- Ashish_Mathur7 years ago
Super User
- Anonymous7 years agoNot applicable
Ashish_Mathur ,
Thank you for your help! I've tried a similar solution using FIRSTNONBLANK and LASTNONBLANK, but didn't work because I'm having to calculate the cumulative return always referencing the first value of the year (in this case 91840.8).I set the value in the variable in the example below to show what I wish to do.
YTD Profit iBovespa = VAR LastValue = CALCULATE( MAX(FatIndexHistoricalData[Value]), FILTER(FatIndexHistoricalData,FatIndexHistoricalData[Date]=MAX(FatIndexHistoricalData[Date])&&FatIndexHistoricalData[IndexKey]=2) ) VAR StartValue = 91840.8 // CALCULATE( // MAX(FatIndexHistoricalData[Value]), // FILTER(ALL(FatIndexHistoricalData),FatIndexHistoricalData[Date]=STARTOFYEAR(FatIndexHistoricalData[Date])&&FatIndexHistoricalData[IndexKey]=2) // ) RETURN (((LastValue / StartValue) - 1) * 100)