<?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 Re: DAX to calculate relative and total percentage growth based on multiple time selections in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-calculate-relative-and-total-percentage-growth-based-on/m-p/1761780#M36868</link>
    <description>&lt;P&gt;Thanks a lot&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="291628" data-lia-user-login="Jihwan_Kim" class="lia-mention lia-mention-user"&gt;Jihwan_Kim&lt;/a&gt;&amp;nbsp;this worked like a charm. I always get confused with the 'ALL' function family.&lt;/P&gt;</description>
    <pubDate>Fri, 02 Apr 2021 14:52:35 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2021-04-02T14:52:35Z</dc:date>
    <item>
      <title>DAX to calculate relative and total percentage growth based on multiple time selections</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-calculate-relative-and-total-percentage-growth-based-on/m-p/1761666#M36861</link>
      <description>&lt;P&gt;I'm trying to calculate few DAX measure to calculate the total balance change between two selected time periods for different codes. The possible outcome would look like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have calculated the first 4 DAX measure as follows:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Time Period 1 = VAR _d1 = MIN(data[Date])
RETURN CALCULATE(SUM(data[Balance]), ALLEXCEPT(data,data[Code]),DATESINPERIOD(data[Date], _d1, -6, MONTH)) - CALCULATE(SUM(data[Balance]), ALLEXCEPT(data,data[Code]),DATESINPERIOD(data[Date], _d1, -3, MONTH))&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Time Period 2 = VAR _d1 = MAX(data[Date])
RETURN CALCULATE(SUM(data[Balance]), ALLEXCEPT(data,data[Code]),DATESINPERIOD(data[Date], _d1, -6, MONTH)) - CALCULATE(SUM(data[Balance]), ALLEXCEPT(data,data[Code]),DATESINPERIOD(data[Date], _d1, -3, MONTH))&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Growth = [Time Period 2]-[Time Period 1]&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;% Growth = DIVIDE([Growth],[Time Period 2])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I created the following DAX for total growth:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Total Growth = var _d1 = MAX(data[Date])
RETURN CALCULATE([% Growth], data[Date]=_d1,ALL(data))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I'm sure something's wrong with the formula as I'm not getting any values:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Theoritically 'total growth' is simply the overall growth for all the codes combined(23.21%) in this case which in turn is used to calculate 'relative growth' = % growth - total growth. I'm not able to capture the total growth primarily because it's calculated based on 2 time periods.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please suggest appropriate modifications to the DAX.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Link to pbix for reference:&amp;nbsp;&lt;A href="https://drive.google.com/file/d/14P9YxYbYqEFZ8VSk7cLuR1li4b6g5m9q/view?usp=sharing" target="_blank" rel="noopener"&gt;https://drive.google.com/file/d/14P9YxYbYqEFZ8VSk7cLuR1li4b6g5m9q/view?usp=sharing&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Apr 2021 13:42:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-calculate-relative-and-total-percentage-growth-based-on/m-p/1761666#M36861</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-04-02T13:42:00Z</dc:date>
    </item>
    <item>
      <title>Re: DAX to calculate relative and total percentage growth based on multiple time selections</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-calculate-relative-and-total-percentage-growth-based-on/m-p/1761753#M36866</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am not sure if I understood correctly, but do you want to show 23.21% for all rows, including the total?&lt;/P&gt;&lt;P&gt;Then, try the below,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE([% Growth], ALLSELECTED(data[Code]))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Sorry for my poor understanding.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;P&gt;&lt;FONT face="”times" color="”#000000”"&gt;&lt;EM&gt;&lt;STRONG&gt;Hi, My name is Jihwan Kim. &lt;/STRONG&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="”times" color="”#000000”"&gt;&lt;EM&gt;&lt;STRONG&gt;If this post helps, then please consider accept it as the solution to help other members find it faster.&lt;/STRONG&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 02 Apr 2021 14:35:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-calculate-relative-and-total-percentage-growth-based-on/m-p/1761753#M36866</guid>
      <dc:creator>Jihwan_Kim</dc:creator>
      <dc:date>2021-04-02T14:35:16Z</dc:date>
    </item>
    <item>
      <title>Re: DAX to calculate relative and total percentage growth based on multiple time selections</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-calculate-relative-and-total-percentage-growth-based-on/m-p/1761780#M36868</link>
      <description>&lt;P&gt;Thanks a lot&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="291628" data-lia-user-login="Jihwan_Kim" class="lia-mention lia-mention-user"&gt;Jihwan_Kim&lt;/a&gt;&amp;nbsp;this worked like a charm. I always get confused with the 'ALL' function family.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Apr 2021 14:52:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-calculate-relative-and-total-percentage-growth-based-on/m-p/1761780#M36868</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-04-02T14:52:35Z</dc:date>
    </item>
  </channel>
</rss>

