<?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: Need Help with Measure in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-Help-with-Measure/m-p/918364#M8960</link>
    <description>&lt;P&gt;Thanks for both suggestions.&amp;nbsp; Since the 2nd one was easier to implement, I started with that one and it worked.&amp;nbsp; (Adding ALL to the Filter of the Measure 1.&amp;nbsp; I will need to think about why that worked!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And I understand the point about the date table.&amp;nbsp; The query that generates this data already computes the period based on the date but I guess doing that in the model is a better solution so I will look at that going forward.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again to both!&lt;/P&gt;</description>
    <pubDate>Fri, 31 Jan 2020 21:39:35 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2020-01-31T21:39:35Z</dc:date>
    <item>
      <title>Need Help with Measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-Help-with-Measure/m-p/915404#M8868</link>
      <description>&lt;P&gt;I am having trouble getting a measure to work. I have two measures that I am trying to get to work together. The first calculates the maximum value in a column (which will tell me the month #). And then the second measure is supposed to sum a column for all values &amp;lt;= to the maximum month value (that will tell me the current reporting month.) Here are my measures...&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;This measure returns the # "1":&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Current Report Month:=CALCULATE(&lt;BR /&gt;MAX(CapitalReportData[PERIOD]),&lt;BR /&gt;FILTER(CapitalReportData,CapitalReportData[COST TYPE]="PO")&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This measure is returning "0" but it should return the sum of FY BUD for months &amp;lt;=1 (Current Report Month)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;YTD Budget:=CALCULATE(&lt;BR /&gt;SUM(CapitalReportData[FY BUD]),&lt;BR /&gt;FILTER(CapitalReportData,CapitalReportData[PERIOD]&amp;lt;=[Current Report Month])&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I re-write the 2nd measure as follows, I get the correct value....&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;YTD Budget:=CALCULATE(&lt;BR /&gt;SUM(CapitalReportData[FY BUD]),&lt;BR /&gt;FILTER(CapitalReportData,CapitalReportData[PERIOD]&amp;lt;=1)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;So my question is, why won't the "YTD Budget" measure return a value when using the "Current Report Month" measure?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jan 2020 17:19:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-Help-with-Measure/m-p/915404#M8868</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-01-29T17:19:52Z</dc:date>
    </item>
    <item>
      <title>Re: Need Help with Measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-Help-with-Measure/m-p/915549#M8872</link>
      <description>&lt;P&gt;The 2nd way isn't working because you don't have a separate date table &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;More specifically, in the second measure...&lt;/P&gt;&lt;PRE&gt;YTDBudget :=&lt;BR /&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;(&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;SUM&lt;/SPAN&gt;( &lt;SPAN&gt;CapitalReportData[FY BUD]&lt;/SPAN&gt; ),&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;FILTER&lt;/SPAN&gt;(&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;CapitalReportData,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;CapitalReportData[PERIOD]&lt;/SPAN&gt; &amp;lt;= &lt;SPAN&gt;[Current Report Month]&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;)&lt;BR /&gt;)&lt;/PRE&gt;&lt;P&gt;...when the first measure i.e. [Current Report Month] gets executed from within the second measure, it's being executed in a nested row-context... so really it looks like this...&lt;/P&gt;&lt;PRE&gt;YTDBudget :=&lt;BR /&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;(&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;SUM&lt;/SPAN&gt;( &lt;SPAN&gt;CapitalReportData[FY BUD]&lt;/SPAN&gt; ),&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;FILTER&lt;/SPAN&gt;(&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;CapitalReportData,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;CapitalReportData[PERIOD]&lt;/SPAN&gt; &amp;lt;=&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;/* first measure */&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;(&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;MAX&lt;/SPAN&gt;( &lt;SPAN&gt;CapitalReportData[PERIOD]&lt;/SPAN&gt; ),&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;FILTER&lt;/SPAN&gt;(&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;CapitalReportData,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;CapitalReportData[COST TYPE]&lt;/SPAN&gt; = &lt;SPAN&gt;"PO"&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;)&lt;BR /&gt;)&lt;/PRE&gt;&lt;P&gt;A better approach is to use a separate date table with a 1-M relationship to your CapitalReportData table. Then change your measures to the following...&lt;/P&gt;&lt;PRE&gt;Current Report &lt;SPAN&gt;Month&lt;/SPAN&gt; :=&lt;BR /&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;(&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;FONT color="#FF0000"&gt;&lt;SPAN&gt;MAX&lt;/SPAN&gt;( &lt;SPAN&gt;'Calendar'[PERIOD]&lt;/SPAN&gt; ),&lt;/FONT&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;FILTER&lt;/SPAN&gt;(&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;CapitalReportData,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;CapitalReportData[COST TYPE]&lt;/SPAN&gt; = &lt;SPAN&gt;"PO"&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;)&lt;BR /&gt;)&lt;/PRE&gt;&lt;P&gt;...and...&lt;/P&gt;&lt;PRE&gt;YTDBudget :=&lt;BR /&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt; __curReportMth = &lt;SPAN&gt;[Current Report Month]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt; __retVal =&amp;nbsp;&lt;BR /&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;(&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;SUM&lt;/SPAN&gt;( &lt;SPAN&gt;CapitalReportData[FY BUD]&lt;/SPAN&gt; ),&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;FILTER&lt;/SPAN&gt;(&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;FONT color="#FF0000"&gt;ALL( 'Calendar')&lt;/FONT&gt; , /* need remove the filter on Period to get YTD */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;FONT color="#FF0000"&gt;Calendar&lt;SPAN&gt;[PERIOD]&lt;/SPAN&gt; &amp;lt;= __curReportMth&lt;/FONT&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;)&lt;BR /&gt;)&lt;BR /&gt;RETURN __retVal&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;HTH&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jan 2020 20:16:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-Help-with-Measure/m-p/915549#M8872</guid>
      <dc:creator>SQLbyoBI</dc:creator>
      <dc:date>2020-01-29T20:16:36Z</dc:date>
    </item>
    <item>
      <title>Re: Need Help with Measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-Help-with-Measure/m-p/915551#M8873</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt; ,&lt;/P&gt;&lt;P&gt;Your first measure is evaluated in the context of the second measure. If the second measure is evaluated in a filtered context based on for example Period = 2, then the first measured will evaluate to 2 and not to the overall MAX of period in the table.&lt;/P&gt;&lt;P&gt;I think this will remedy this for you:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Current Report Month:=CALCULATE(
MAX(CapitalReportData[PERIOD]),
FILTER(ALL(CapitalReportData),CapitalReportData[COST TYPE]="PO")
)&lt;/LI-CODE&gt;&lt;P&gt;By using ALL() in your FILTER(), the evaluation context is changed and now this measure will always result in the same value, regardless of the context it is evaluated in (e.g. a matrix visual for example).&lt;/P&gt;&lt;P&gt;Hope that this makes sense, let me know if this helped you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind regards&lt;/P&gt;&lt;P&gt;Djerro123&lt;/P&gt;&lt;P&gt;-------------------------------&lt;/P&gt;&lt;P&gt;If this answered your question, please &lt;STRONG&gt;mark it as the Solution&lt;/STRONG&gt;. This also helps others to find what they are looking for.&lt;/P&gt;&lt;P&gt;Keep those &lt;STRONG&gt;thumbs up&lt;/STRONG&gt; coming! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jan 2020 20:19:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-Help-with-Measure/m-p/915551#M8873</guid>
      <dc:creator>JarroVGIT</dc:creator>
      <dc:date>2020-01-29T20:19:16Z</dc:date>
    </item>
    <item>
      <title>Re: Need Help with Measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-Help-with-Measure/m-p/918364#M8960</link>
      <description>&lt;P&gt;Thanks for both suggestions.&amp;nbsp; Since the 2nd one was easier to implement, I started with that one and it worked.&amp;nbsp; (Adding ALL to the Filter of the Measure 1.&amp;nbsp; I will need to think about why that worked!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And I understand the point about the date table.&amp;nbsp; The query that generates this data already computes the period based on the date but I guess doing that in the model is a better solution so I will look at that going forward.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again to both!&lt;/P&gt;</description>
      <pubDate>Fri, 31 Jan 2020 21:39:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-Help-with-Measure/m-p/918364#M8960</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-01-31T21:39:35Z</dc:date>
    </item>
    <item>
      <title>Re: Need Help with Measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-Help-with-Measure/m-p/918368#M8961</link>
      <description>&lt;P&gt;One more question on this... Is there a way for me to see what the Filter was returning in my original formula?&amp;nbsp; I think that might help me better understand the fix.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 31 Jan 2020 21:44:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-Help-with-Measure/m-p/918368#M8961</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-01-31T21:44:17Z</dc:date>
    </item>
  </channel>
</rss>

