<?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: Allocate expenses in one region to others, regardless of filter context in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Allocate-expenses-in-one-region-to-others-regardless-of-filter/m-p/4209107#M166908</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="625922" data-lia-user-login="bhanu_gautam" class="lia-mention lia-mention-user"&gt;bhanu_gautam&lt;/a&gt;&amp;nbsp;Thanks for looking into this. Unfortunately it's not working, implemented as v2:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfiltered:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Filtered (one region):&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Filtered (two regions):&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Do you have any other ideas? Thank you in advance for your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 01 Oct 2024 15:15:02 GMT</pubDate>
    <dc:creator>AnnieTay</dc:creator>
    <dc:date>2024-10-01T15:15:02Z</dc:date>
    <item>
      <title>Allocate expenses in one region to others, regardless of filter context</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Allocate-expenses-in-one-region-to-others-regardless-of-filter/m-p/4208379#M166845</link>
      <description>&lt;P&gt;Simplified sample file:&amp;nbsp;&lt;A href="https://drive.google.com/file/d/1zRo5x9_MWJ_TyViU_W81bLfD1xQaICfP/view?usp=sharing" target="_self"&gt;pbix&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have two tables:&lt;/P&gt;&lt;P&gt;1. Staff: EmpID, Name, Region, Function&lt;/P&gt;&lt;P&gt;2. Expenses: EmpID, Expense&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The requirement is to allocate all expenses from Region C equally to Region A and Region B, and the report should no longer show Region C.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have partially achieved this through the following measure:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Expenses (Budget) =&lt;BR /&gt;// Expenses for Region C are equally allocated to Region A and Region B&lt;/P&gt;&lt;P&gt;VAR RegionExpense = CALCULATE(&lt;BR /&gt;SUM(Expenses[Expense]),&lt;BR /&gt;Staff[Region] = "Region C"&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;VAR TotalExpense = SUM(Expenses[Expense])&lt;BR /&gt;VAR SelectedRegion = SELECTEDVALUE(Staff[Region])&lt;/P&gt;&lt;P&gt;RETURN&lt;BR /&gt;SWITCH(&lt;BR /&gt;TRUE(),&lt;BR /&gt;SelectedRegion IN {"Region A", "Region B"}, TotalExpense + (RegionExpense / 2),&lt;BR /&gt;SelectedRegion IN {"Region C"}, BLANK(),&lt;BR /&gt;TotalExpense&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This works, except when a &lt;STRONG&gt;user filters on two regions&lt;/STRONG&gt;. For example, if they select Region A AND Region B, I would like the Function graph to essentially show Region A + Region B + Region C. If they select Region A and Region D, I would like the Function graph to show Region A + 1/2 Region C + Region D. Ideally, the measure should handle any combination of Region selections.&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 tried ALL, ALLSELECTED etc with no luck. Thank you in advance for your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Oct 2024 12:48:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Allocate-expenses-in-one-region-to-others-regardless-of-filter/m-p/4208379#M166845</guid>
      <dc:creator>AnnieTay</dc:creator>
      <dc:date>2024-10-01T12:48:26Z</dc:date>
    </item>
    <item>
      <title>Re: Allocate expenses in one region to others, regardless of filter context</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Allocate-expenses-in-one-region-to-others-regardless-of-filter/m-p/4209043#M166905</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="778694" data-lia-user-login="AnnieTay" class="lia-mention lia-mention-user"&gt;AnnieTay&lt;/a&gt;&amp;nbsp;, Try using below DAX&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Expenses (Budget) =&lt;BR /&gt;VAR RegionCExpense = CALCULATE(&lt;BR /&gt;SUM(Expenses[Expense]),&lt;BR /&gt;Staff[Region] = "Region C"&lt;BR /&gt;)&lt;/P&gt;
&lt;P&gt;VAR TotalExpense = SUM(Expenses[Expense])&lt;BR /&gt;VAR SelectedRegions = VALUES(Staff[Region])&lt;BR /&gt;VAR RegionCount = COUNTROWS(SelectedRegions)&lt;/P&gt;
&lt;P&gt;RETURN&lt;BR /&gt;SWITCH(&lt;BR /&gt;TRUE(),&lt;BR /&gt;"Region C" IN SelectedRegions, &lt;BR /&gt;IF(&lt;BR /&gt;RegionCount = 1,&lt;BR /&gt;BLANK(),&lt;BR /&gt;TotalExpense + (RegionCExpense / (RegionCount - 1))&lt;BR /&gt;),&lt;BR /&gt;TotalExpense&lt;BR /&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Oct 2024 14:54:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Allocate-expenses-in-one-region-to-others-regardless-of-filter/m-p/4209043#M166905</guid>
      <dc:creator>bhanu_gautam</dc:creator>
      <dc:date>2024-10-01T14:54:30Z</dc:date>
    </item>
    <item>
      <title>Re: Allocate expenses in one region to others, regardless of filter context</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Allocate-expenses-in-one-region-to-others-regardless-of-filter/m-p/4209107#M166908</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="625922" data-lia-user-login="bhanu_gautam" class="lia-mention lia-mention-user"&gt;bhanu_gautam&lt;/a&gt;&amp;nbsp;Thanks for looking into this. Unfortunately it's not working, implemented as v2:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfiltered:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Filtered (one region):&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Filtered (two regions):&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Do you have any other ideas? Thank you in advance for your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Oct 2024 15:15:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Allocate-expenses-in-one-region-to-others-regardless-of-filter/m-p/4209107#M166908</guid>
      <dc:creator>AnnieTay</dc:creator>
      <dc:date>2024-10-01T15:15:02Z</dc:date>
    </item>
    <item>
      <title>Re: Allocate expenses in one region to others, regardless of filter context</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Allocate-expenses-in-one-region-to-others-regardless-of-filter/m-p/4211691#M166984</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="778694" data-lia-user-login="AnnieTay" class="lia-mention lia-mention-user"&gt;AnnieTay&lt;/a&gt;&amp;nbsp;, hello&amp;nbsp;bhanu_gautam, thank you for your prompt reply!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As I understand it, no matter how you combine the filters, in your measure, all the expenditures in Region C have been equally distributed to Region A and Region B, please explain your confusion clearly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In addition, you could also try the following measure and let me know the result:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure = 
VAR RegionCExpense = CALCULATE(
    SUM(Expenses[Expense]),
    Staff[Region] = "Region C"
)

VAR TotalExpense = SUM(Expenses[Expense])
VAR SelectedRegion = SELECTEDVALUE(Staff[Region])

VAR IsRegionASelected = ISFILTERED(Staff[Region]) &amp;amp;&amp;amp; SELECTEDVALUE(Staff[Region]) = "Region A"
VAR IsRegionBSelected = ISFILTERED(Staff[Region]) &amp;amp;&amp;amp; SELECTEDVALUE(Staff[Region]) = "Region B"

VAR RegionAExpense = IF(IsRegionASelected, TotalExpense + (RegionCExpense / 2), TotalExpense)
VAR RegionBExpense = IF(IsRegionBSelected, TotalExpense + (RegionCExpense / 2), TotalExpense)

RETURN
SWITCH(
    TRUE(),
    SelectedRegion = "Region A", RegionAExpense,
    SelectedRegion = "Region B", RegionBExpense,
    SelectedRegion = "Region D", TotalExpense,
    SelectedRegion = "Region C", BLANK(),
    TotalExpense
)
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;Joyce&lt;/P&gt;
&lt;P&gt;If this post&amp;nbsp;&lt;STRONG&gt;helps&lt;/STRONG&gt;, 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;</description>
      <pubDate>Wed, 02 Oct 2024 09:32:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Allocate-expenses-in-one-region-to-others-regardless-of-filter/m-p/4211691#M166984</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-10-02T09:32:43Z</dc:date>
    </item>
    <item>
      <title>Re: Allocate expenses in one region to others, regardless of filter context</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Allocate-expenses-in-one-region-to-others-regardless-of-filter/m-p/4211762#M166986</link>
      <description>&lt;P&gt;Thank you so much&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;, that works well! Would you be able to assist in adjusting the measure so that the Total also reflects the selected Regions? For example, if I select Region A &amp;amp; Region B, the total should be 1,400. If I select Region B &amp;amp; Region D, the total should be 750 etc?&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Oct 2024 10:12:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Allocate-expenses-in-one-region-to-others-regardless-of-filter/m-p/4211762#M166986</guid>
      <dc:creator>AnnieTay</dc:creator>
      <dc:date>2024-10-02T10:12:23Z</dc:date>
    </item>
    <item>
      <title>Re: Allocate expenses in one region to others, regardless of filter context</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Allocate-expenses-in-one-region-to-others-regardless-of-filter/m-p/4233160#M167422</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="778694" data-lia-user-login="AnnieTay" class="lia-mention lia-mention-user"&gt;AnnieTay&lt;/a&gt; ,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your feedback.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please try the Measure2 as shown below:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure2 = 
VAR RegionCExpense = CALCULATE(
    SUM(Expenses[Expense]),
    Staff[Region] = "Region C"
)

VAR TotalExpense = SUM(Expenses[Expense])
VAR SelectedCount = COUNTROWS(ALLSELECTED(Staff[Region]))

VAR HasRegionA = CONTAINS(VALUES(Staff[Region]), Staff[Region], "Region A")
VAR HasRegionB = CONTAINS(VALUES(Staff[Region]), Staff[Region], "Region B")
VAR HasRegionC = CONTAINS(VALUES(Staff[Region]), Staff[Region], "Region C")
VAR HasRegionD = CONTAINS(VALUES(Staff[Region]), Staff[Region], "Region D")

VAR RegionAExpense = IF(HasRegionA, TotalExpense + (RegionCExpense / 2), TotalExpense)
VAR RegionBExpense = IF(HasRegionB, TotalExpense + (RegionCExpense / 2), TotalExpense)

RETURN
IF(
    ISINSCOPE(Staff[Region]), 
    SWITCH(
        TRUE(),
        HasRegionA, RegionAExpense,
        HasRegionB, RegionBExpense,
        HasRegionC, BLANK(),  
        TotalExpense  
    ),
    SWITCH(
        TRUE(),
        SelectedCount = 1 &amp;amp;&amp;amp; HasRegionA, RegionAExpense,
        SelectedCount = 1 &amp;amp;&amp;amp; HasRegionB, RegionBExpense,
        SelectedCount &amp;gt; 1 &amp;amp;&amp;amp; HasRegionA &amp;amp;&amp;amp; HasRegionB &amp;amp;&amp;amp; HasRegionC, TotalExpense,
        SelectedCount &amp;gt; 1 &amp;amp;&amp;amp; HasRegionA &amp;amp;&amp;amp; HasRegionB &amp;amp;&amp;amp; NOT HasRegionC, TotalExpense + RegionCExpense,
        SelectedCount &amp;gt; 1 &amp;amp;&amp;amp; HasRegionA &amp;amp;&amp;amp; HasRegionD &amp;amp;&amp;amp; NOT HasRegionC, TotalExpense + RegionCExpense/2,
        SelectedCount &amp;gt; 1 &amp;amp;&amp;amp; HasRegionB &amp;amp;&amp;amp; HasRegionD &amp;amp;&amp;amp; NOT HasRegionC, TotalExpense + RegionCExpense/2,
        SelectedCount &amp;gt; 1 &amp;amp;&amp;amp; HasRegionA &amp;amp;&amp;amp; HasRegionC, TotalExpense - (RegionCExpense / 2),
        SelectedCount &amp;gt; 1 &amp;amp;&amp;amp; HasRegionB &amp;amp;&amp;amp; HasRegionC, TotalExpense - (RegionCExpense / 2),
        SelectedCount &amp;gt; 1 &amp;amp;&amp;amp; HasRegionC &amp;amp;&amp;amp; NOT (HasRegionA &amp;amp;&amp;amp; HasRegionB), TotalExpense - RegionCExpense,
        TotalExpense  
    )
)
&lt;/LI-CODE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;Joyce&lt;/P&gt;
&lt;P&gt;If this post&amp;nbsp;&lt;STRONG&gt;helps&lt;/STRONG&gt;, 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>Tue, 08 Oct 2024 08:15:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Allocate-expenses-in-one-region-to-others-regardless-of-filter/m-p/4233160#M167422</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-10-08T08:15:50Z</dc:date>
    </item>
    <item>
      <title>Re: Allocate expenses in one region to others, regardless of filter context</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Allocate-expenses-in-one-region-to-others-regardless-of-filter/m-p/4233646#M167440</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;, much appreciated!&lt;/P&gt;</description>
      <pubDate>Tue, 08 Oct 2024 13:23:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Allocate-expenses-in-one-region-to-others-regardless-of-filter/m-p/4233646#M167440</guid>
      <dc:creator>AnnieTay</dc:creator>
      <dc:date>2024-10-08T13:23:53Z</dc:date>
    </item>
  </channel>
</rss>

