<?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: Automatically redistribute the target per customer in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Automatically-redistribute-the-target-per-customer/m-p/3657461#M141708</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="570958" data-lia-user-login="Rai_BI" class="lia-mention lia-mention-user"&gt;Rai_BI&lt;/a&gt;&amp;nbsp;- I'm sorry to hear the calculation is slow.&amp;nbsp; As I stated, I created a very simplified model to test out the DAX I provided.&amp;nbsp; It is difficult to help troubleshoot slow calculations without actually seeing your data model.&lt;/P&gt;</description>
    <pubDate>Wed, 24 Jan 2024 15:13:56 GMT</pubDate>
    <dc:creator>AUaero</dc:creator>
    <dc:date>2024-01-24T15:13:56Z</dc:date>
    <item>
      <title>Automatically redistribute the target per customer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Automatically-redistribute-the-target-per-customer/m-p/3654369#M141583</link>
      <description>&lt;P&gt;In Power BI I have a table with customer portfolios. In this table there are the fields Customer Code, Customer Name, Wallet Code, Wallet Name.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I also have the table with the sales record and in this table there are the Date of Sale and Customer Code fields.&lt;BR /&gt;I also have a table with the goals for each client portfolio and in this table there are the fields Target Month, Target Value, Portfolio Code, Portfolio Name.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Consider the following situation:&lt;/P&gt;&lt;P&gt;The "AA" portfolio sold a total of 100,000, distributed among the 3 clients that are part of the portfolio. And this portfolio has a total target of 130,000&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The "BB" portfolio sold a total of 300,000, distributed among the 5 clients that are part of the portfolio. And this portfolio has a total target of 350,000&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The "CC" portfolio sold a total of 250,000, distributed among the 7 clients that are part of the portfolio. And this portfolio has a total target of 280,000&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For the "AA" portfolio, I need to apply a target to the clients of this portfolio considering the percentage weight that each client represents in the total of 100,000 in the portfolio.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For the "BB" portfolio I need to apply a target to the clients of this portfolio considering the percentage weight that each client represents in the total of 300,000 in the portfolio.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For the "CC" portfolio I need to apply a target to the clients of this portfolio considering the percentage weight that each client represents in the total of 250,000 in the portfolio.&lt;BR /&gt;&lt;BR /&gt;Is it possible to create a DAX measure that is capable of performing this goal calculation automatically?&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2024 14:45:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Automatically-redistribute-the-target-per-customer/m-p/3654369#M141583</guid>
      <dc:creator>Rai_BI</dc:creator>
      <dc:date>2024-01-23T14:45:06Z</dc:date>
    </item>
    <item>
      <title>Re: Automatically redistribute the target per customer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Automatically-redistribute-the-target-per-customer/m-p/3654920#M141595</link>
      <description>&lt;P&gt;I've created a simplified model based on your description with the following measures that you should be able to modify to get the result you're looking for.&lt;BR /&gt;&lt;BR /&gt;Sales Measure:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;$ Sales = SUM(Sales[SaleAmount])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Portfolio Target Measure:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;$ Portfolio Target = 
CALCULATE(
    SUM(Goals[Target]),
    FILTER(
        Customers,
        COUNTROWS(VALUES(Customers[CustomerCode])) &amp;gt; 0
    )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Customer Target Measure:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;$ Customer Target = 
VAR _CustomerSales = Sales[$ Sales]

VAR _TotalSales = 
CALCULATE(
    Sales[$ Sales],
    ALL(Customers),
    VALUES(Portfolio[PortfolioID])
)

VAR _PercentToTotal = 
DIVIDE(_CustomerSales, _TotalSales)

VAR _PortfolioTarget = Goals[$ Portfolio Target]

VAR _CustomerTarget = 
_PercentToTotal * _PortfolioTarget

RETURN
_CustomerTarget&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Result:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Consider providing a dataset to work with on future requests; this will make it much easier to answer your questions.&lt;BR /&gt;&lt;BR /&gt;If this solves your problem, please mark this answer as the solution.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2024 19:11:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Automatically-redistribute-the-target-per-customer/m-p/3654920#M141595</guid>
      <dc:creator>AUaero</dc:creator>
      <dc:date>2024-01-23T19:11:22Z</dc:date>
    </item>
    <item>
      <title>Re: Automatically redistribute the target per customer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Automatically-redistribute-the-target-per-customer/m-p/3657126#M141684</link>
      <description>&lt;P&gt;Thank you very much!&lt;BR /&gt;&lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;I am facing a slow calculation problem. It's taking a long time to calculate.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jan 2024 13:50:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Automatically-redistribute-the-target-per-customer/m-p/3657126#M141684</guid>
      <dc:creator>Rai_BI</dc:creator>
      <dc:date>2024-01-24T13:50:06Z</dc:date>
    </item>
    <item>
      <title>Re: Automatically redistribute the target per customer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Automatically-redistribute-the-target-per-customer/m-p/3657461#M141708</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="570958" data-lia-user-login="Rai_BI" class="lia-mention lia-mention-user"&gt;Rai_BI&lt;/a&gt;&amp;nbsp;- I'm sorry to hear the calculation is slow.&amp;nbsp; As I stated, I created a very simplified model to test out the DAX I provided.&amp;nbsp; It is difficult to help troubleshoot slow calculations without actually seeing your data model.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jan 2024 15:13:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Automatically-redistribute-the-target-per-customer/m-p/3657461#M141708</guid>
      <dc:creator>AUaero</dc:creator>
      <dc:date>2024-01-24T15:13:56Z</dc:date>
    </item>
  </channel>
</rss>

