<?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: Can't fix &amp;quot;Wrong&amp;quot; Total in Matrix in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Can-t-fix-quot-Wrong-quot-Total-in-Matrix/m-p/2362302#M60412</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="325088" data-lia-user-login="Micha3lS" class="lia-mention lia-mention-user"&gt;Micha3lS&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;you need to wrap DIVIDE inside SUMX with CALCULATE&lt;/P&gt;</description>
    <pubDate>Sat, 26 Feb 2022 12:57:51 GMT</pubDate>
    <dc:creator>tamerj1</dc:creator>
    <dc:date>2022-02-26T12:57:51Z</dc:date>
    <item>
      <title>Can't fix "Wrong" Total in Matrix</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Can-t-fix-quot-Wrong-quot-Total-in-Matrix/m-p/2361377#M60364</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I currently have the problem, that I can't get the total to work. I tried to use SUMX to aggregrate and Prodcutgroup level, but still I'm not getting the correct Reulst.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The formula looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Target = 
Var _AvgCyclTime = Calculate(                    
                    Divide(SUM(PlanData[Fertigungszeit Verteilzeit]),SUM(PlanData[Vorgangsmenge])),      
                    FILTER(PlanData, PlanData[Produktgruppe] &amp;lt;&amp;gt; "Collabs")
)

RETURN
CALCULATE(
    SUMX(
        VALUES(ProductionLines[Produktgruppe]),
        Divide('scheduled production shifts'[Capacity], _AvgCyclTime)* MIN(PlanData[TargetOEE])
    ),
    KEEPFILTERS(PlanData[Produktgruppe] &amp;lt;&amp;gt; "Collabs")
)&lt;/LI-CODE&gt;&lt;P&gt;Scheduled production shifts'[capacity'] is another is another measure:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Capacity = Sum('scheduled production shifts'[Scheduled Time sec])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Visual looks like this:&lt;BR /&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the rows it works exactly like intendet, but I can't get the result like shown here:&amp;nbsp;&lt;BR /&gt;&lt;A href="https://www.sqlbi.com/articles/obtaining-accurate-totals-in-dax/" target="_blank"&gt;https://www.sqlbi.com/articles/obtaining-accurate-totals-in-dax/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;I really can't get my head around it and would appreciate an help.&lt;BR /&gt;Thank you&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;</description>
      <pubDate>Fri, 25 Feb 2022 14:32:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Can-t-fix-quot-Wrong-quot-Total-in-Matrix/m-p/2361377#M60364</guid>
      <dc:creator>Micha3lS</dc:creator>
      <dc:date>2022-02-25T14:32:33Z</dc:date>
    </item>
    <item>
      <title>Re: Can't fix "Wrong" Total in Matrix</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Can-t-fix-quot-Wrong-quot-Total-in-Matrix/m-p/2361654#M60381</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="325088" data-lia-user-login="Micha3lS" class="lia-mention lia-mention-user"&gt;Micha3lS&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;can you please share a screenshot of your data model?&amp;nbsp;&lt;BR /&gt;in the visual, what are slicing by?&lt;/P&gt;</description>
      <pubDate>Fri, 25 Feb 2022 16:39:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Can-t-fix-quot-Wrong-quot-Total-in-Matrix/m-p/2361654#M60381</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-02-25T16:39:09Z</dc:date>
    </item>
    <item>
      <title>Re: Can't fix "Wrong" Total in Matrix</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Can-t-fix-quot-Wrong-quot-Total-in-Matrix/m-p/2361937#M60390</link>
      <description>&lt;P&gt;One potential issue here is that your MIN is not operating in the row context that you're iterating over. That is, it's taking the min over all the Produktgruppe values in the local filter context rather than performing a &lt;A href="https://www.sqlbi.com/articles/understanding-context-transition/" target="_blank"&gt;context transition&lt;/A&gt; and only considering the value in the row context.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this is the only problem, you can correct it by wrapping it with CALCULATE to force a context transition.&lt;/P&gt;
&lt;LI-CODE lang="php"&gt;Target =
VAR _AvgCyclTime =
    CALCULATE (
        DIVIDE (
            SUM ( PlanData[Fertigungszeit Verteilzeit] ),
            SUM ( PlanData[Vorgangsmenge] )
        ),
        FILTER ( PlanData, PlanData[Produktgruppe] &amp;lt;&amp;gt; "Collabs" )
    )
RETURN
    CALCULATE (
        SUMX (
            VALUES ( ProductionLines[Produktgruppe] ),
            DIVIDE ( 'scheduled production shifts'[Capacity], _AvgCyclTime )
                * CALCULATE ( MIN ( PlanData[TargetOEE] ) )
        ),
        KEEPFILTERS ( PlanData[Produktgruppe] &amp;lt;&amp;gt; "Collabs" )
    )&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 25 Feb 2022 21:43:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Can-t-fix-quot-Wrong-quot-Total-in-Matrix/m-p/2361937#M60390</guid>
      <dc:creator>AlexisOlson</dc:creator>
      <dc:date>2022-02-25T21:43:06Z</dc:date>
    </item>
    <item>
      <title>Re: Can't fix "Wrong" Total in Matrix</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Can-t-fix-quot-Wrong-quot-Total-in-Matrix/m-p/2362232#M60405</link>
      <description>&lt;P&gt;Thanks for your Input, unfotrunately that didn't change the Total Result.&lt;/P&gt;</description>
      <pubDate>Sat, 26 Feb 2022 07:40:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Can-t-fix-quot-Wrong-quot-Total-in-Matrix/m-p/2362232#M60405</guid>
      <dc:creator>Micha3lS</dc:creator>
      <dc:date>2022-02-26T07:40:54Z</dc:date>
    </item>
    <item>
      <title>Re: Can't fix "Wrong" Total in Matrix</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Can-t-fix-quot-Wrong-quot-Total-in-Matrix/m-p/2362234#M60406</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Im slicing by the location and a maschinegroup in addtion to the date and year.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The location and machinegroup are stored in the same table as the Produktgruppe in the Table Productionlines.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a Screenshot of the relevant tables:&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;</description>
      <pubDate>Sat, 26 Feb 2022 07:44:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Can-t-fix-quot-Wrong-quot-Total-in-Matrix/m-p/2362234#M60406</guid>
      <dc:creator>Micha3lS</dc:creator>
      <dc:date>2022-02-26T07:44:45Z</dc:date>
    </item>
    <item>
      <title>Re: Can't fix "Wrong" Total in Matrix</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Can-t-fix-quot-Wrong-quot-Total-in-Matrix/m-p/2362302#M60412</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="325088" data-lia-user-login="Micha3lS" class="lia-mention lia-mention-user"&gt;Micha3lS&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;you need to wrap DIVIDE inside SUMX with CALCULATE&lt;/P&gt;</description>
      <pubDate>Sat, 26 Feb 2022 12:57:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Can-t-fix-quot-Wrong-quot-Total-in-Matrix/m-p/2362302#M60412</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-02-26T12:57:51Z</dc:date>
    </item>
    <item>
      <title>Re: Can't fix "Wrong" Total in Matrix</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Can-t-fix-quot-Wrong-quot-Total-in-Matrix/m-p/2362686#M60426</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That didn't work either, unfrotunately. Nothing changed.&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;</description>
      <pubDate>Sun, 27 Feb 2022 06:43:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Can-t-fix-quot-Wrong-quot-Total-in-Matrix/m-p/2362686#M60426</guid>
      <dc:creator>Micha3lS</dc:creator>
      <dc:date>2022-02-27T06:43:45Z</dc:date>
    </item>
    <item>
      <title>Re: Can't fix "Wrong" Total in Matrix</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Can-t-fix-quot-Wrong-quot-Total-in-Matrix/m-p/2364164#M60490</link>
      <description>&lt;P&gt;I finally found the Solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My Calculate was at the wrong spot. Here is the working code:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Target = 
SUMX(
    VALUES(ProductionLines[Produktgruppe]),
    CALCULATE(
        Divide('scheduled production shifts'[Capacity], Divide(SUM(PlanData[Fertigungszeit Verteilzeit]),SUM(PlanData[Vorgangsmenge]))) * MIN(PlanData[TargetOEE]),
        KEEPFILTERS(ProductionLines[Produktgruppe] &amp;lt;&amp;gt; "Collabs")
    )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However putting parts of the Divide into a variable with the same logic is not working. Can you explain why? Or do I only add the modifiers like Filters etc. in the Return and in the variable I only write the formula itself without the other stuff??&lt;BR /&gt;&lt;BR /&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Feb 2022 09:23:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Can-t-fix-quot-Wrong-quot-Total-in-Matrix/m-p/2364164#M60490</guid>
      <dc:creator>Micha3lS</dc:creator>
      <dc:date>2022-02-28T09:23:45Z</dc:date>
    </item>
  </channel>
</rss>

