Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Create a Line Graph showing changes to a portfolio over time using the most recent values by month

Hello, I've spent quite some time trying to figure this on my own and diving deep into the forums and haven't come away with a clear answer, so I'm hoping someone here can guide me in the right direc...
  • Ashish_Mathur's avatar
    Ashish_Mathur
    3 years ago

    Hi,

    You may download my PBi file from here.

    Hope this helps.

  • Anonymous's avatar
    Anonymous
    3 years ago

    Thanks, this is it. So folks are aware or the OneDrive link inevitably dies, here's the logic. 

     

    You need to create a calendar table (date dim) 

    Calendar = CALENDAR(MIN(Data[Created_Date]),EOMONTH(MAX(Data[Created_Date]),0))

     

    Sum your cost from the Data Table

    TC = SUM(Data[Total Cost])

     

    Use the following measure:

    Measure = CALCULATE([TC],LASTNONBLANK(CALCULATETABLE('Calendar',DATESBETWEEN('Calendar'[Date],minx(ALL('Calendar'),'Calendar'[Date]),max('Calendar'[Date]))),CALCULATE([tc])))

     

    Lastly, do the following:

    Measure 3 = SUMX(CALCULATETABLE(VALUES(Data[Portfolio]),all('Calendar')),[Measure])

    I had to replace the VALUES(Data[Portfolio]) with SUMMARIZE(Data, Data[Column 1], Data[Column 2], etc) to get what I wanted.