<?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: Overhead Expnese Allocation by Branch in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Overhead-Expnese-Allocation-by-Branch/m-p/4099319#M162673</link>
    <description>&lt;P&gt;&lt;FONT&gt;Hi All,&lt;BR /&gt;Firstly, PurpleGate thank your for you solutions!&lt;BR /&gt;And&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="745604" data-lia-user-login="emre34" class="lia-mention lia-mention-user"&gt;emre34&lt;/a&gt;&amp;nbsp;for you question, I think there is a problem with your TotalSalesExcludingHQ , there is no good way to calculate the total value after the HQ.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We simply remove 'Branch' [BRANCH_ID] to properly sum TotalSalesExcludingHQ.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;MeasureAllocationOverheadCN5 = 

VAR currentcountryid = MAX(COUNTRY[COUNTRY_ID])

VAR Totaloverhead = 
    CALCULATE( SUM(OVERHEAD_EXPENSES[OVERHEAD_EXPENSES]), BRANCH[BRANCH_ID] = 80 )

VAR TotalSalesExcludingHQ = 
    CALCULATE( 
        SUM(SALES[SALES_TEAM_A]) + SUM(SALES[SALES_TEAM_B]),Country[COUNTRY_ID]=5,
        REMOVEFILTERS('Branch'[BRANCH_ID])
       
        
    ) 

VAR BranchSales = 
    SUM(SALES[SALES_TEAM_A]) + SUM(SALES[SALES_TEAM_B])

VAR AllocationPerBranch = 
    DIVIDE(Totaloverhead, TotalSalesExcludingHQ, 0) * BranchSales

RETURN 
    IF(
        currentcountryid=5,
        AllocationPerBranch,
0)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;If you still have questions, check out the pbix file I uploaded, I hope it helps!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope it helps!&lt;/P&gt;
&lt;P&gt;Best regards,&lt;BR /&gt;Community Support Team_ Tom Shen&lt;/P&gt;
&lt;P&gt;If this post helps then please consider&amp;nbsp;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 14 Aug 2024 05:53:18 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-08-14T05:53:18Z</dc:date>
    <item>
      <title>Overhead Expnese Allocation by Branch</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Overhead-Expnese-Allocation-by-Branch/m-p/4094475#M162482</link>
      <description>&lt;P&gt;I have sales via branch id and also have a branch id as a headquarter, i want to allocate all the overhead expenses upon sales amounts.&lt;/P&gt;&lt;P&gt;so i want to make it in math = ( total overhead for country5 / total sales for country5 ) * sales by branch&lt;/P&gt;&lt;P&gt;but when i wrote below DAX code, it doesn't show the allocated expenses across to the branches in the visual table.&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;LI-CODE lang="markup"&gt;MeasureAllocationOverheadCN5 = 
var currentcountryid = SELECTEDVALUE(COUNTRY[COUNTRY_ID])

VAR Totaloverhead = 
    CALCULATE( [Overhead Expenses],BRANCH[BRANCH_ID] = 80) –- headquarter branchid is 80

VAR TotalSalesExcludingHQ = 
    CALCULATE( ( [Total Sales Team A] + [Total Sales Team B] ), COUNTRY[COUNTRY_ID] = 5) –- just want to allocate for country 5

VAR BranchSales = 
    CALCULATE( ( [Total Sales Team A] + [Total Sales Team B] ), COUNTRY[COUNTRY_ID] = 5)


VAR AllocationPerBranch = 
    DIVIDE(Toteloverhead, TotalSalesExcludingHQ) * BranchSales

RETURN 
    IF(
        currentcountryid = 5,
        AllocationPerBranch,
        BLANK()
    ) &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;</description>
      <pubDate>Mon, 12 Aug 2024 05:16:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Overhead-Expnese-Allocation-by-Branch/m-p/4094475#M162482</guid>
      <dc:creator>emre34</dc:creator>
      <dc:date>2024-08-12T05:16:27Z</dc:date>
    </item>
    <item>
      <title>Re: Overhead Expnese Allocation by Branch</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Overhead-Expnese-Allocation-by-Branch/m-p/4094693#M162498</link>
      <description>&lt;P&gt;sometimes you need to use FILTER in the measure so it actually can limit the table as expected&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;MeasureAllocationOverheadCN5 = 
var currentcountryid = SELECTEDVALUE(COUNTRY[COUNTRY_ID])

VAR Totaloverhead = 
    CALCULATE( [Overhead Expenses],FILTER(BRANCH, BRANCH[BRANCH_ID] = 80)) –- headquarter branchid is 80

VAR TotalSalesExcludingHQ = 
    CALCULATE( ( [Total Sales Team A] + [Total Sales Team B] ), FILTER(COUNTRY,COUNTRY[COUNTRY_ID] = 5)) –- just want to allocate for country 5

VAR BranchSales = 
    CALCULATE( ( [Total Sales Team A] + [Total Sales Team B] ),FILTER(COUNTRY, COUNTRY[COUNTRY_ID] = 5))


VAR AllocationPerBranch = 
    DIVIDE(Toteloverhead, TotalSalesExcludingHQ) * BranchSales

RETURN 
    IF(
        currentcountryid = 5,
        AllocationPerBranch,
        BLANK()
    ) &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Aug 2024 07:04:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Overhead-Expnese-Allocation-by-Branch/m-p/4094693#M162498</guid>
      <dc:creator>PurpleGate</dc:creator>
      <dc:date>2024-08-12T07:04:27Z</dc:date>
    </item>
    <item>
      <title>Re: Overhead Expnese Allocation by Branch</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Overhead-Expnese-Allocation-by-Branch/m-p/4099319#M162673</link>
      <description>&lt;P&gt;&lt;FONT&gt;Hi All,&lt;BR /&gt;Firstly, PurpleGate thank your for you solutions!&lt;BR /&gt;And&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="745604" data-lia-user-login="emre34" class="lia-mention lia-mention-user"&gt;emre34&lt;/a&gt;&amp;nbsp;for you question, I think there is a problem with your TotalSalesExcludingHQ , there is no good way to calculate the total value after the HQ.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We simply remove 'Branch' [BRANCH_ID] to properly sum TotalSalesExcludingHQ.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;MeasureAllocationOverheadCN5 = 

VAR currentcountryid = MAX(COUNTRY[COUNTRY_ID])

VAR Totaloverhead = 
    CALCULATE( SUM(OVERHEAD_EXPENSES[OVERHEAD_EXPENSES]), BRANCH[BRANCH_ID] = 80 )

VAR TotalSalesExcludingHQ = 
    CALCULATE( 
        SUM(SALES[SALES_TEAM_A]) + SUM(SALES[SALES_TEAM_B]),Country[COUNTRY_ID]=5,
        REMOVEFILTERS('Branch'[BRANCH_ID])
       
        
    ) 

VAR BranchSales = 
    SUM(SALES[SALES_TEAM_A]) + SUM(SALES[SALES_TEAM_B])

VAR AllocationPerBranch = 
    DIVIDE(Totaloverhead, TotalSalesExcludingHQ, 0) * BranchSales

RETURN 
    IF(
        currentcountryid=5,
        AllocationPerBranch,
0)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;If you still have questions, check out the pbix file I uploaded, I hope it helps!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope it helps!&lt;/P&gt;
&lt;P&gt;Best regards,&lt;BR /&gt;Community Support Team_ Tom Shen&lt;/P&gt;
&lt;P&gt;If this post helps then please consider&amp;nbsp;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2024 05:53:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Overhead-Expnese-Allocation-by-Branch/m-p/4099319#M162673</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-08-14T05:53:18Z</dc:date>
    </item>
  </channel>
</rss>

