<?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: How to apply a measure calculation before roll up in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-apply-a-measure-calculation-before-roll-up/m-p/2240772#M53640</link>
    <description>&lt;P&gt;Thank you that works!!&lt;BR /&gt;&lt;BR /&gt;I further changed the DAX to calculate margins of the sales reps &amp;lt;.2 and it works however the sub total row aggregates the percentages. Is there anyway to handle this please?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Less 20% Margin 2 = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;SUMX&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VALUES&lt;/SPAN&gt;&lt;SPAN&gt; ( &lt;/SPAN&gt;&lt;SPAN&gt;'dim'[Sales Rep]&lt;/SPAN&gt;&lt;SPAN&gt; ),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;IF&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;[Margin]&lt;/SPAN&gt;&lt;SPAN&gt; &amp;lt; &lt;/SPAN&gt;&lt;SPAN&gt;.2&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt; ( &lt;/SPAN&gt;&lt;SPAN&gt;[Margin]&lt;/SPAN&gt;&lt;SPAN&gt;) ,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;img /&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Wed, 15 Dec 2021 17:46:48 GMT</pubDate>
    <dc:creator>2366</dc:creator>
    <dc:date>2021-12-15T17:46:48Z</dc:date>
    <item>
      <title>How to apply a measure calculation before roll up</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-apply-a-measure-calculation-before-roll-up/m-p/2240014#M53583</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I needed some help to understand how to apply a DAX expression before roll up -&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's a sample dataset -&lt;/P&gt;&lt;P&gt;DIM&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;FACT&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 am trying to calculate the total sales amount from every city where the sales rep margin &amp;lt;20%. DAX works fine when I keep Sales Rep in the context but when I remove Sales rep field, the calculation doesnt work anymore&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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DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 15 Dec 2021 10:24:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-apply-a-measure-calculation-before-roll-up/m-p/2240014#M53583</guid>
      <dc:creator>2366</dc:creator>
      <dc:date>2021-12-15T10:24:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to apply a measure calculation before roll up</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-apply-a-measure-calculation-before-roll-up/m-p/2240135#M53591</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;Without the sales rep context your calculation is done to all of the data in the data set and it seems for new york this aggregate is greater than 20%. To solve this you can calculate the margin in a calcuated column and then appy the if condition to the calculated column to get the margin on a transaction level.&lt;BR /&gt;&lt;BR /&gt;I hope this helps to solve your issue and if it does consider accepting this as a solution.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Dec 2021 11:16:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-apply-a-measure-calculation-before-roll-up/m-p/2240135#M53591</guid>
      <dc:creator>ValtteriN</dc:creator>
      <dc:date>2021-12-15T11:16:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to apply a measure calculation before roll up</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-apply-a-measure-calculation-before-roll-up/m-p/2240613#M53625</link>
      <description>&lt;P&gt;Add an iterator at whatever the appropriate level of granularity is.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Assuming Sales Rep the granularity you want, try this:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Less 20% Margin =
SUMX (
    VALUES ( 'dim'[Sales Rep] ),
    IF (
        [Margin] &amp;lt; .2,
        CALCULATE ( SUM ( 'Fact'[Selling] ) ),
        0
    )
)&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 15 Dec 2021 16:02:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-apply-a-measure-calculation-before-roll-up/m-p/2240613#M53625</guid>
      <dc:creator>AlexisOlson</dc:creator>
      <dc:date>2021-12-15T16:02:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to apply a measure calculation before roll up</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-apply-a-measure-calculation-before-roll-up/m-p/2240772#M53640</link>
      <description>&lt;P&gt;Thank you that works!!&lt;BR /&gt;&lt;BR /&gt;I further changed the DAX to calculate margins of the sales reps &amp;lt;.2 and it works however the sub total row aggregates the percentages. Is there anyway to handle this please?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Less 20% Margin 2 = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;SUMX&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VALUES&lt;/SPAN&gt;&lt;SPAN&gt; ( &lt;/SPAN&gt;&lt;SPAN&gt;'dim'[Sales Rep]&lt;/SPAN&gt;&lt;SPAN&gt; ),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;IF&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;[Margin]&lt;/SPAN&gt;&lt;SPAN&gt; &amp;lt; &lt;/SPAN&gt;&lt;SPAN&gt;.2&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt; ( &lt;/SPAN&gt;&lt;SPAN&gt;[Margin]&lt;/SPAN&gt;&lt;SPAN&gt;) ,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;img /&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 15 Dec 2021 17:46:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-apply-a-measure-calculation-before-roll-up/m-p/2240772#M53640</guid>
      <dc:creator>2366</dc:creator>
      <dc:date>2021-12-15T17:46:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to apply a measure calculation before roll up</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-apply-a-measure-calculation-before-roll-up/m-p/2240843#M53645</link>
      <description>&lt;P&gt;This measure is designed to add up the values for each Sales Rep separately so it shouldn't be used when you don't want to do that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm not sure, but I'm guessing you want something more like this:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Less 20% Margin 2 =
CALCULATE (
    [Margin],
    FILTER (
        VALUES ( 'dim'[Sales Rep] ),
        [Margin] &amp;lt; .2
    )
)&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 15 Dec 2021 18:37:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-apply-a-measure-calculation-before-roll-up/m-p/2240843#M53645</guid>
      <dc:creator>AlexisOlson</dc:creator>
      <dc:date>2021-12-15T18:37:57Z</dc:date>
    </item>
  </channel>
</rss>

