<?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 Need to divide a column by subtotal of another column in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-to-divide-a-column-by-subtotal-of-another-column/m-p/3476849#M157066</link>
    <description>&lt;P&gt;I have a database of sales and returns for each department of each branch. I am responsible for the data for only one branch, so I can filter the table to only show that one. The columns I have are:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Fiscal Year (FY); Branch (BR); Department (Dep); Sales (S); Returns (R)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Based on these columns, I can filter Branch to just mine (eg Branch A), show the % Returns for each department (R/S %) , and overall Branch returns (Fiscal Year subtotal of R/S). However, the sales of some departments are much much larger than others. So I want to show the impact of each department on the overall Branch returns year-on-year. So what I need is to divide the "Returns" column by the Fiscal Year subtotal of "Sales".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sample Table: &lt;A href="https://i.imgur.com/gHmQ81E.png" target="_blank" rel="noopener"&gt;https://i.imgur.com/gHmQ81E.png&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The pink column is what I want to dynamically calculate, right now it is manually done by dividing the green column by the hard coded number 62912. This does not work for year-on-year trend since the blue number will change for each fiscal year. Ultimately, I want to plot these on a stacked column chart to show Branch overall % Return and each dept's relative contribution to it, similar to this: &lt;A href="https://i.imgur.com/6cJs0OY.png" target="_blank" rel="noopener"&gt;https://i.imgur.com/6cJs0OY.png&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Update: I figured it out with some googling. In case it helps someone else out, here is the method I used:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Weighted_Returns =&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;DIVIDE&lt;/STRONG&gt;&lt;SPAN&gt;('Table'[Returns],&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;CALCULATE&lt;/STRONG&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;STRONG&gt;SUM&lt;/STRONG&gt;&lt;SPAN&gt;('Table'[Sales],&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;ALLEXCEPT&lt;/STRONG&gt;&lt;SPAN&gt;('Table'[Branch], 'Table'[Fiscal Year]))))&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 14 Oct 2023 23:43:27 GMT</pubDate>
    <dc:creator>FsmA</dc:creator>
    <dc:date>2023-10-14T23:43:27Z</dc:date>
    <item>
      <title>Need to divide a column by subtotal of another column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-to-divide-a-column-by-subtotal-of-another-column/m-p/3476849#M157066</link>
      <description>&lt;P&gt;I have a database of sales and returns for each department of each branch. I am responsible for the data for only one branch, so I can filter the table to only show that one. The columns I have are:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Fiscal Year (FY); Branch (BR); Department (Dep); Sales (S); Returns (R)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Based on these columns, I can filter Branch to just mine (eg Branch A), show the % Returns for each department (R/S %) , and overall Branch returns (Fiscal Year subtotal of R/S). However, the sales of some departments are much much larger than others. So I want to show the impact of each department on the overall Branch returns year-on-year. So what I need is to divide the "Returns" column by the Fiscal Year subtotal of "Sales".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sample Table: &lt;A href="https://i.imgur.com/gHmQ81E.png" target="_blank" rel="noopener"&gt;https://i.imgur.com/gHmQ81E.png&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The pink column is what I want to dynamically calculate, right now it is manually done by dividing the green column by the hard coded number 62912. This does not work for year-on-year trend since the blue number will change for each fiscal year. Ultimately, I want to plot these on a stacked column chart to show Branch overall % Return and each dept's relative contribution to it, similar to this: &lt;A href="https://i.imgur.com/6cJs0OY.png" target="_blank" rel="noopener"&gt;https://i.imgur.com/6cJs0OY.png&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Update: I figured it out with some googling. In case it helps someone else out, here is the method I used:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Weighted_Returns =&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;DIVIDE&lt;/STRONG&gt;&lt;SPAN&gt;('Table'[Returns],&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;CALCULATE&lt;/STRONG&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;STRONG&gt;SUM&lt;/STRONG&gt;&lt;SPAN&gt;('Table'[Sales],&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;ALLEXCEPT&lt;/STRONG&gt;&lt;SPAN&gt;('Table'[Branch], 'Table'[Fiscal Year]))))&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 14 Oct 2023 23:43:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-to-divide-a-column-by-subtotal-of-another-column/m-p/3476849#M157066</guid>
      <dc:creator>FsmA</dc:creator>
      <dc:date>2023-10-14T23:43:27Z</dc:date>
    </item>
  </channel>
</rss>

