<?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 Stuck with rolling up a measure! Help! in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Stuck-with-rolling-up-a-measure-Help/m-p/738818#M2180</link>
    <description>&lt;P&gt;Calling all PBI Wizards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have been spinning my wheels on this for more time than I would like to admit and cannot come up with a solution. I have created a measure that is fairly straight forward and works in a table visual when it has the proper context:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Test = 

Var
    Max Date = 'Data'[Max Date]

var 
    Flag = if('Data'[Return] &amp;lt; 0, 1,0)
Return

Flag * calculate(sum('Data'[USD]), 
        FILTER('Data',
        sum('Data'[YR1_Return]) &amp;lt;&amp;gt; blank() &amp;amp;&amp;amp;
        'Data'[Flag] = "N" &amp;amp;&amp;amp; 
        'Data'[Date] = Max Date))&lt;/PRE&gt;&lt;P&gt;The reason why this works in a table visual is it executing the multiplier in the context of an account, however when I remove the context of the account instead of multiplying each row by a 1 that meets the criteria, it multiplies my total amount by a 0 as there is not context for the flag variable, returning zero.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried a calculated column in order to execute the flag on a row level, however this does not give me the same result, however I am not sure why.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My question is, how can I create a measure to roll this up as I need to use the results of this measure to generate multiple other measures.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Appreciate any and all help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;JMWB&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>Fri, 12 Jul 2019 14:47:46 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-07-12T14:47:46Z</dc:date>
    <item>
      <title>Stuck with rolling up a measure! Help!</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Stuck-with-rolling-up-a-measure-Help/m-p/738818#M2180</link>
      <description>&lt;P&gt;Calling all PBI Wizards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have been spinning my wheels on this for more time than I would like to admit and cannot come up with a solution. I have created a measure that is fairly straight forward and works in a table visual when it has the proper context:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Test = 

Var
    Max Date = 'Data'[Max Date]

var 
    Flag = if('Data'[Return] &amp;lt; 0, 1,0)
Return

Flag * calculate(sum('Data'[USD]), 
        FILTER('Data',
        sum('Data'[YR1_Return]) &amp;lt;&amp;gt; blank() &amp;amp;&amp;amp;
        'Data'[Flag] = "N" &amp;amp;&amp;amp; 
        'Data'[Date] = Max Date))&lt;/PRE&gt;&lt;P&gt;The reason why this works in a table visual is it executing the multiplier in the context of an account, however when I remove the context of the account instead of multiplying each row by a 1 that meets the criteria, it multiplies my total amount by a 0 as there is not context for the flag variable, returning zero.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried a calculated column in order to execute the flag on a row level, however this does not give me the same result, however I am not sure why.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My question is, how can I create a measure to roll this up as I need to use the results of this measure to generate multiple other measures.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Appreciate any and all help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;JMWB&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>Fri, 12 Jul 2019 14:47:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Stuck-with-rolling-up-a-measure-Help/m-p/738818#M2180</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-07-12T14:47:46Z</dc:date>
    </item>
    <item>
      <title>Re: Stuck with rolling up a measure! Help!</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Stuck-with-rolling-up-a-measure-Help/m-p/739226#M2203</link>
      <description>&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490" target="_blank"&gt;https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best&lt;/P&gt;&lt;P&gt;Darek&lt;/P&gt;</description>
      <pubDate>Sat, 13 Jul 2019 16:17:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Stuck-with-rolling-up-a-measure-Help/m-p/739226#M2203</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-07-13T16:17:38Z</dc:date>
    </item>
    <item>
      <title>Re: Stuck with rolling up a measure! Help!</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Stuck-with-rolling-up-a-measure-Help/m-p/739227#M2204</link>
      <description>&lt;P&gt;Hi again.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wanna see your model (I already see that it's most likely incorrect) and would also want you to describe what the measure you're after should do.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best&lt;/P&gt;&lt;P&gt;Darek&lt;/P&gt;</description>
      <pubDate>Sat, 13 Jul 2019 16:21:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Stuck-with-rolling-up-a-measure-Help/m-p/739227#M2204</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-07-13T16:21:39Z</dc:date>
    </item>
  </channel>
</rss>

