<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Profit drawdown against weighted average portfolio in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Profit-drawdown-against-weighted-average-portfolio/m-p/3148790#M112741</link>
    <description>&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have created measures that show&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Maximum cumulated Profit – field [**Max Profit]&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;** Max Profit =

Maxx(

     ALLSELECTED(Dates),

     [*Profit running total in Date]

    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Minimum cumulated Profit – field [**Min Profit]&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;** Min Profit =

Minx(

     ALLSELECTED(Dates),

     [*Profit running total in Date]

    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;The maximum drawdown Field [**Max Drawdown] is the difference between (1) and (2) above&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;** Max Drawdown = [** Max Profit] - [** MIN Profit]​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;I have a Portfolio total value Field is [Total Value]&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Total Value = ROUND([Equity Value] + [Cash Value], 2)​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;I have drawings and incoming funds under Field [Deposits]&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Deposits = 
IF(VALUES(Config[TrackCash])="Yes"
  , CALCULATE([Trans Total Amnt], TransType[DepositTransSign] = 1)
   -CALCULATE([Trans Total Amnt], TransType[DepositTransSign] = -1)
)​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;I wish to create a measure that takes the [Total value] at the maximum profit that is adjusted by [Deposits] thereafter until the minimum vale is reached. This is therefore the [**Adjusted Portfolio Value]&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;** Portfolio Adjusted = [Total Value]+[Deposits]​&lt;/LI-CODE&gt;&lt;P&gt;This measure I would need to create some date logic to pick [Total Value] at date of maximum profit??&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;The aim then is to calculate the Drawdown % against weighted average [**Adjusted Portfolio Value].&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;I am attaching link to an excel spreadsheet that is showing my calculations in excel.&lt;BR /&gt;&lt;A href="https://1drv.ms/x/s!ArtOMe8OWNmVgslT9J1W3io1jpxsNw?e=FG1hzA" target="_blank" rel="noopener"&gt;Drawdown data.xlsx&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I am trying to code this [ie. drawdown % against weighted average portfolio] in Power BI but it is beyond my capacities.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I’d appreciate guidance.&lt;/P&gt;</description>
    <pubDate>Thu, 23 Mar 2023 03:55:05 GMT</pubDate>
    <dc:creator>CNH1</dc:creator>
    <dc:date>2023-03-23T03:55:05Z</dc:date>
    <item>
      <title>Profit drawdown against weighted average portfolio</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Profit-drawdown-against-weighted-average-portfolio/m-p/3148790#M112741</link>
      <description>&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have created measures that show&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Maximum cumulated Profit – field [**Max Profit]&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;** Max Profit =

Maxx(

     ALLSELECTED(Dates),

     [*Profit running total in Date]

    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Minimum cumulated Profit – field [**Min Profit]&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;** Min Profit =

Minx(

     ALLSELECTED(Dates),

     [*Profit running total in Date]

    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;The maximum drawdown Field [**Max Drawdown] is the difference between (1) and (2) above&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;** Max Drawdown = [** Max Profit] - [** MIN Profit]​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;I have a Portfolio total value Field is [Total Value]&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Total Value = ROUND([Equity Value] + [Cash Value], 2)​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;I have drawings and incoming funds under Field [Deposits]&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Deposits = 
IF(VALUES(Config[TrackCash])="Yes"
  , CALCULATE([Trans Total Amnt], TransType[DepositTransSign] = 1)
   -CALCULATE([Trans Total Amnt], TransType[DepositTransSign] = -1)
)​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;I wish to create a measure that takes the [Total value] at the maximum profit that is adjusted by [Deposits] thereafter until the minimum vale is reached. This is therefore the [**Adjusted Portfolio Value]&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;** Portfolio Adjusted = [Total Value]+[Deposits]​&lt;/LI-CODE&gt;&lt;P&gt;This measure I would need to create some date logic to pick [Total Value] at date of maximum profit??&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;The aim then is to calculate the Drawdown % against weighted average [**Adjusted Portfolio Value].&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;I am attaching link to an excel spreadsheet that is showing my calculations in excel.&lt;BR /&gt;&lt;A href="https://1drv.ms/x/s!ArtOMe8OWNmVgslT9J1W3io1jpxsNw?e=FG1hzA" target="_blank" rel="noopener"&gt;Drawdown data.xlsx&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I am trying to code this [ie. drawdown % against weighted average portfolio] in Power BI but it is beyond my capacities.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I’d appreciate guidance.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2023 03:55:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Profit-drawdown-against-weighted-average-portfolio/m-p/3148790#M112741</guid>
      <dc:creator>CNH1</dc:creator>
      <dc:date>2023-03-23T03:55:05Z</dc:date>
    </item>
    <item>
      <title>Re: Profit drawdown against weighted average portfolio</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Profit-drawdown-against-weighted-average-portfolio/m-p/3164819#M113773</link>
      <description>&lt;P&gt;I continued to work on this question.&lt;/P&gt;&lt;P&gt;I have created the following measures:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;**MaxDate = MAXX(FILTER(ALLSELECTED(Dates), [*Profit running total in Date] = [** Max **bleep** Profit]), Dates[Date]) &lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;**MinDate = MAXX(FILTER(ALLSELECTED(Dates), [*Profit running total in Date] = [** MIN **bleep** Profit]), Dates[Date]) &lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;***Drawdown Days = Datediff([**MaxDate],[**MinDate],DAY)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So what I am now trying to achieve is to sum&amp;nbsp;‘Report’[** Portfolio Adjusted] between the **MaxDate and **MinDate&lt;BR /&gt;&lt;BR /&gt;This is the point I am struggling with. I have tried various DAX code, with out success. One of which is&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;SUMX(FILTER(ALLSELECTED('Dates'),'Dates'[Date] &amp;gt;= [**MinDate] &amp;amp;&amp;amp; 'Dates'[Date] &amp;lt;= [**MaxDate]),'Report'[**Portfolio Adjusted])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;This is returning (Blank).&amp;nbsp;&amp;nbsp; Can someone direct me on a correction&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Once I resolve this I will then divide [**MaxDrawdown] by this sum.&lt;BR /&gt;&lt;BR /&gt;Hopefully someone can point me in the right direction.&lt;/P&gt;</description>
      <pubDate>Fri, 31 Mar 2023 04:23:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Profit-drawdown-against-weighted-average-portfolio/m-p/3164819#M113773</guid>
      <dc:creator>CNH1</dc:creator>
      <dc:date>2023-03-31T04:23:46Z</dc:date>
    </item>
    <item>
      <title>Re: Profit drawdown against weighted average portfolio</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Profit-drawdown-against-weighted-average-portfolio/m-p/3166904#M113923</link>
      <description>&lt;P&gt;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&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;*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
    ))&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 01 Apr 2023 03:32:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Profit-drawdown-against-weighted-average-portfolio/m-p/3166904#M113923</guid>
      <dc:creator>CNH1</dc:creator>
      <dc:date>2023-04-01T03:32:51Z</dc:date>
    </item>
  </channel>
</rss>

