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 mutliple date filters based on multiple date columns, all requiring a custome financial year, so I find it easier to create fiscal year and quarter columns, as caculate columns, for each date in the Projects table - I'm not sure how relevant this is but wanted to mention it. Regardless, I have an active date table relationship with the Start Date and an inactive date table relaionship with the End Date. 

 

I'd like to create a calculation that sums the total value of the portfolio over time. So in a line graph, for any given day, I want to see the sum Total Value of all Start Dates on or before the given day minus the sum Total Value of all End Dates on or before that given day. I need this to react to both my Start Date and End Date filters - which I currently have setup using my Start Date and End Date columns directly in the Project table. 

 

Here is a sample table:

 

IDProject NameStart DateEnd DateLastest USD Value
8Iron Man6/28/20206/28/2023100000
9Batman2/14/20212/14/202240000
42Spiderman5/5/20205/5/202210000
52Hulk10/1/20201/1/20221000000
57Wolverine7/1/20237/1/2025750000
79Daredevil9/1/20199/1/202360000
90Superman1/1/20215/1/2021100000
93Wonder Woman3/23/20223/1/202435000
133Thor5/9/20225/14/20262000000
  • 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.

2 Replies

  • 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
    Not applicable

    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.