<?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: Formula Excel to DAX in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Formula-Excel-to-DAX/m-p/2569471#M73324</link>
    <description>&lt;P&gt;The solution is perfect, thanks!&lt;/P&gt;</description>
    <pubDate>Thu, 09 Jun 2022 14:30:37 GMT</pubDate>
    <dc:creator>mlozano</dc:creator>
    <dc:date>2022-06-09T14:30:37Z</dc:date>
    <item>
      <title>Formula Excel to DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Formula-Excel-to-DAX/m-p/2559712#M72784</link>
      <description>&lt;P&gt;Hello, I have a problem migrating a formula from excel to DAX.&amp;nbsp; My excel file is as follows:&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;The formula that I am trying to replicate is the one in the red text called &lt;STRONG&gt;"NR/hl Cat Mix"&lt;/STRONG&gt;, in excel it is formulated as follows, it is really very simple:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;(Peso SKU Act - Peso SKU Base) * (NR/Hl Cat Base - NR/Hl Total Base)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The formula in Excel is recalculated row by row, that is, every time I filter a dimension in my Excel table, the values ​​are recalculated row by row and depending on the applied filters there is always a new result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;when I try to replicate my excel formula in DAX, the behavior is completely different, I have no problem calculating the values ​​of the subtraction &lt;STRONG&gt;(Peso SKU Act - Peso SKU Base)&lt;/STRONG&gt;, both are percentage shares of each &lt;STRONG&gt;SKU ID&lt;/STRONG&gt; over the total of each volume (&lt;STRONG&gt;LE Volume&lt;/STRONG&gt; and &lt;STRONG&gt;ACT Volume&lt;/STRONG&gt;), these in Excel as mentioned above, are calculated row by row in Excel, in DAX I do it as a Measure to be able to assign the same behavior from the recalculation that has the result in Excel.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My drawback is that when I subtract both actions in DAX, the result is &lt;STRONG&gt;0&lt;/STRONG&gt;, I have not been able to force the context of the row, I have already thought that the best solution would be a calculated column but I get static results, they are not recalculated according to the applied filters, so when adding, the result is very low or very high.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The shares in DAX, as a measure, I am calculating it like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Peso% SKU Act = DIVIDE(SUMX(Worksheet,[ACT Volume]),CALCULATE(SUM(Worksheet[ACT Volume]),ALLSELECTED(Worksheet)))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Peso% SKU Base = DIVIDE(SUMX(Worksheet,[LE Volume]),CALCULATE(SUM(Worksheet[LE Volume]),ALLSELECTED(Worksheet)))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As mentioned, the subtraction between both participations is 100%, so when subtracting them the result is 0.&amp;nbsp;With the results of (NR/Hl Base Cat - NR/Hl Base Total), I have no problem. It's just that when you multiply it by 0, the result of &lt;STRONG&gt;"NR/hl Cat Mix"&lt;/STRONG&gt; will always be 0, which is not correct.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am sharing a sample of the data, which also contains the formula I want to replicate ("NR/hl Cat Mix"):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;A href="https://1drv.ms/x/s!AgYZFTdxng_ufyqzKoAUBX3Tx8E?e=IJETrq" target="_self"&gt;Sample Data&lt;/A&gt;&amp;nbsp;&lt;/STRONG&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;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;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 05 Jun 2022 21:08:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Formula-Excel-to-DAX/m-p/2559712#M72784</guid>
      <dc:creator>mlozano</dc:creator>
      <dc:date>2022-06-05T21:08:23Z</dc:date>
    </item>
    <item>
      <title>Re: Formula Excel to DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Formula-Excel-to-DAX/m-p/2568672#M73267</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="344681" data-lia-user-login="mlozano" class="lia-mention lia-mention-user"&gt;mlozano&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please try this.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;NR/hl Cat Mix1 = 
SUMX(
SUMMARIZE(
    'Worksheet',
    'Worksheet'[Field 1 Name],
    'Worksheet'[Field 2 Name],
    'Worksheet'[Field 3 Name],
    'Worksheet'[Field 4 Name],
    'Worksheet'[Field 5 Name],

...

    'Worksheet'[NR/Hl Cat Base],
    'Worksheet'[NR/Hl Total  Base],
    "Act",[Peso% SKU Act],
    "Base",[Peso% SKU Base]
),
([Act]-[Base])*('Worksheet'[NR/Hl Cat Base]-'Worksheet'[NR/Hl Total  Base])
)&lt;/LI-CODE&gt;
&lt;P&gt;Attached PBIX file for reference.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;Best Regards,&lt;BR /&gt;Gao&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;Community Support Team&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;If there is any post&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT size="3" color="#FF0000"&gt;&lt;EM&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;&lt;/EM&gt;&lt;/FONT&gt;, then please consider&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT size="3"&gt;&lt;FONT color="#FF0000"&gt;&lt;EM&gt;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;&lt;FONT size="3"&gt;Thanks a lot!&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2" color="#FF0000"&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;How to get your questions answered quickly&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;--&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;How to provide sample data&lt;/SPAN&gt;&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jun 2022 09:19:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Formula-Excel-to-DAX/m-p/2568672#M73267</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-06-09T09:19:37Z</dc:date>
    </item>
    <item>
      <title>Re: Formula Excel to DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Formula-Excel-to-DAX/m-p/2569471#M73324</link>
      <description>&lt;P&gt;The solution is perfect, thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jun 2022 14:30:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Formula-Excel-to-DAX/m-p/2569471#M73324</guid>
      <dc:creator>mlozano</dc:creator>
      <dc:date>2022-06-09T14:30:37Z</dc:date>
    </item>
  </channel>
</rss>

