Forum Discussion

Jordan-Adrian's avatar
Jordan-Adrian
New Member
2 years ago
Solved

Portfolio Value Over Time

I have a Projects table containing a potfolio of projects. Each project has a Start Date and an End Date as well as a Total Value. Although I do have a date table, I dont use it often because I use m...
  • Ritaf1983's avatar
    2 years ago

    Hi Jordan-Adrian 

    If i understood you correctly you can use a disconnected dates table 

    And dax 

    portfolio_value =
    VAR selectedDate = MAX('calendar'[Date])

    RETURN

    SUMX('portfolio',
    VAR StartDate = [Start date]
    VAR EndDate = [End Date]
    RETURN IF(StartDate<= selectedDate && OR(EndDate>=selectedDate, EndDate=BLANK() ),[Lastest USD Value],0)
    )

    pbix is attached

    If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi Jordan-Adrian ,

     

    According to your statement, I think you can try code as below to create a measure.

    Measure = 
    VAR _SELECTION = SELECTEDVALUE('Calendar'[Date])
    VAR _SUM1 = CALCULATE(SUM('Table'[Lastest USD Value]),FILTER('Table','Table'[Start Date]<=_SELECTION))
    VAR _SUM2 = CALCULATE(SUM('Table'[Lastest USD Value]),FILTER('Table','Table'[End Date]<=_SELECTION))
    RETURN
    _SUM1 - _SUM2

    Result is as below.


    Best Regards,
    Rico Zhou

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.