Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
I am trying to get a formula that shows the drawdown on an investment portfolio from a Peak profit to a minimum profit following that peak.
I have created measures that show
** Max Profit =
Maxx(
ALLSELECTED(Dates),
[*Profit running total in Date]
)
** Min Profit =
Minx(
ALLSELECTED(Dates),
[*Profit running total in Date]
)
** Max Drawdown = [** Max Profit] - [** MIN Profit]
Total Value = ROUND([Equity Value] + [Cash Value], 2)
Deposits =
IF(VALUES(Config[TrackCash])="Yes"
, CALCULATE([Trans Total Amnt], TransType[DepositTransSign] = 1)
-CALCULATE([Trans Total Amnt], TransType[DepositTransSign] = -1)
)
** Portfolio Adjusted = [Total Value]+[Deposits]
This measure I would need to create some date logic to pick [Total Value] at date of maximum profit??
I am attaching link to an excel spreadsheet that is showing my calculations in excel.
Drawdown data.xlsx
I am trying to code this [ie. drawdown % against weighted average portfolio] in Power BI but it is beyond my capacities.
I’d appreciate guidance.
Solved! Go to Solution.
I have not been able to get to the Weighted average, calculated on a daily basis. Given the materiality I have decided to use the average of the opening and closing. As such this is where I have finished
*Max Drawdown % =
VAR PortfolioAdjustedMIN =
SUMX(
FILTER(
'Dates',
'Dates'[Date] = [*MinDate]
),
[*Portfolio Adjusted]
)
VAR PortfolioAdjustedMAX =
SUMX(
FILTER(
'Dates',
'Dates'[Date] = [*MaxDate]
),
[*Portfolio Adjusted]
)
RETURN
DIVIDE(
[*Max Drawdown],
DIVIDE(
PortfolioAdjustedMAX + PortfolioAdjustedMIN,
2
))
I continued to work on this question.
I have created the following measures:
**MaxDate = MAXX(FILTER(ALLSELECTED(Dates), [*Profit running total in Date] = [** Max **bleep** Profit]), Dates[Date])
**MinDate = MAXX(FILTER(ALLSELECTED(Dates), [*Profit running total in Date] = [** MIN **bleep** Profit]), Dates[Date])
***Drawdown Days = Datediff([**MaxDate],[**MinDate],DAY)
So what I am now trying to achieve is to sum ‘Report’[** Portfolio Adjusted] between the **MaxDate and **MinDate
This is the point I am struggling with. I have tried various DAX code, with out success. One of which is
SUMX(FILTER(ALLSELECTED('Dates'),'Dates'[Date] >= [**MinDate] && 'Dates'[Date] <= [**MaxDate]),'Report'[**Portfolio Adjusted])
This is returning (Blank). Can someone direct me on a correction
Once I resolve this I will then divide [**MaxDrawdown] by this sum.
Hopefully someone can point me in the right direction.
I have not been able to get to the Weighted average, calculated on a daily basis. Given the materiality I have decided to use the average of the opening and closing. As such this is where I have finished
*Max Drawdown % =
VAR PortfolioAdjustedMIN =
SUMX(
FILTER(
'Dates',
'Dates'[Date] = [*MinDate]
),
[*Portfolio Adjusted]
)
VAR PortfolioAdjustedMAX =
SUMX(
FILTER(
'Dates',
'Dates'[Date] = [*MaxDate]
),
[*Portfolio Adjusted]
)
RETURN
DIVIDE(
[*Max Drawdown],
DIVIDE(
PortfolioAdjustedMAX + PortfolioAdjustedMIN,
2
))
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
22 | |
21 | |
19 | |
13 | |
12 |
User | Count |
---|---|
41 | |
32 | |
23 | |
22 | |
22 |