<?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: Different result when using Measure as a variable vs using a scalar. in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Different-result-when-using-Measure-as-a-variable-vs-using-a/m-p/3975993#M154166</link>
    <description>&lt;P&gt;Thanks for the reply but unfortunately that doesn't work either.&lt;BR /&gt;The chart looks like this:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;The _condition returns 5 as well.&lt;/P&gt;</description>
    <pubDate>Thu, 06 Jun 2024 05:43:26 GMT</pubDate>
    <dc:creator>2NV_DB</dc:creator>
    <dc:date>2024-06-06T05:43:26Z</dc:date>
    <item>
      <title>Different result when using Measure as a variable vs using a scalar.</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Different-result-when-using-Measure-as-a-variable-vs-using-a/m-p/3975604#M154154</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a dax measure that finds the last date within the exisiting year of a data set and then it extracts the month:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;ThisMonthBasedOnInvoices = 
VAR _thisyear = YEAR(TODAY())

VAR _lastinvoicedate = LASTDATE(Consolidated_Sales_ActualTable[Sales_Invoice_date])

VAR _calculation = MONTH(CALCULATE(_lastinvoicedate,FILTER('Financial Calendar','Financial Calendar'[Year]=_thisyear)))

RETURN
_calculation&lt;/LI-CODE&gt;&lt;P&gt;If I put this measure in a card, I get 5 (which is what I expected).&lt;BR /&gt;&lt;BR /&gt;When I take this measure and use it in a filter of another measure like so:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;IncrementalSales24 = 

CALCULATE(([SalesSum24]-[SalesSum23]),
FILTER('Financial Calendar','Financial Calendar'[Month Number]&amp;lt;=[ThisMonthBasedOnInvoices]

))&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;I get the following chart which is not what I want.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;If instead I use a scalar value of 5 like so, I get the chart I do want:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;IncrementalSales24 = 

CALCULATE(([SalesSum24]-[SalesSum23]),
FILTER('Financial Calendar','Financial Calendar'[Month Number]&amp;lt;=5

))&lt;/LI-CODE&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I would have expected both charts to be the same. Why is there a difference if the first measure equates to 5?&lt;BR /&gt;&lt;BR /&gt;Essentially I am trying to hide months in my chart that do not yet have data.&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jun 2024 01:21:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Different-result-when-using-Measure-as-a-variable-vs-using-a/m-p/3975604#M154154</guid>
      <dc:creator>2NV_DB</dc:creator>
      <dc:date>2024-06-06T01:21:53Z</dc:date>
    </item>
    <item>
      <title>Re: Different result when using Measure as a variable vs using a scalar.</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Different-result-when-using-Measure-as-a-variable-vs-using-a/m-p/3975904#M154162</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;In my opinion, it is because of context transition when using [measure] inside CALCULATE DAX function.&lt;/P&gt;
&lt;P&gt;Row context -&amp;gt; Filter context&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/dax/calculate-function-dax?wt.mc_id=DP-MVP-5004989" target="_blank"&gt;CALCULATE function (DAX) - DAX | Microsoft Learn&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Please try something like below whether it suits your requirement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;IncrementalSales24 =
VAR _condition = [ThisMonthBasedOnInvoices]
VAR _result =
    CALCULATE (
        ( [SalesSum24] - [SalesSum23] ),
        FILTER (
            'Financial Calendar',
            'Financial Calendar'[Month Number] &amp;lt;= _condition
        )
    )
RETURN
    _result
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jun 2024 03:57:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Different-result-when-using-Measure-as-a-variable-vs-using-a/m-p/3975904#M154162</guid>
      <dc:creator>Jihwan_Kim</dc:creator>
      <dc:date>2024-06-06T03:57:25Z</dc:date>
    </item>
    <item>
      <title>Re: Different result when using Measure as a variable vs using a scalar.</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Different-result-when-using-Measure-as-a-variable-vs-using-a/m-p/3975993#M154166</link>
      <description>&lt;P&gt;Thanks for the reply but unfortunately that doesn't work either.&lt;BR /&gt;The chart looks like this:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;The _condition returns 5 as well.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jun 2024 05:43:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Different-result-when-using-Measure-as-a-variable-vs-using-a/m-p/3975993#M154166</guid>
      <dc:creator>2NV_DB</dc:creator>
      <dc:date>2024-06-06T05:43:26Z</dc:date>
    </item>
    <item>
      <title>Re: Different result when using Measure as a variable vs using a scalar.</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Different-result-when-using-Measure-as-a-variable-vs-using-a/m-p/3978383#M154255</link>
      <description>&lt;P&gt;Any other suggestions?&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2024 02:24:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Different-result-when-using-Measure-as-a-variable-vs-using-a/m-p/3978383#M154255</guid>
      <dc:creator>2NV_DB</dc:creator>
      <dc:date>2024-06-07T02:24:51Z</dc:date>
    </item>
    <item>
      <title>Re: Different result when using Measure as a variable vs using a scalar.</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Different-result-when-using-Measure-as-a-variable-vs-using-a/m-p/3978801#M154271</link>
      <description>&lt;P&gt;The issue is that Lastdate is dynamic and because of it&amp;nbsp; it is not giving correct output try the below&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;ThisMonthBasedOnInvoices = 
VAR _thisyear = YEAR(TODAY())

VAR _lastinvoicedate = Calculate(LASTDATE(Consolidated_Sales_ActualTable[Sales_Invoice_date]),all(Consolidated_Sales_ActualTable))

VAR _calculation = MONTH(_lastinvoicedate)

RETURN
_calculation&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Best Regards&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Devender Kumar&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If this&amp;nbsp;&lt;STRONG&gt;&lt;I&gt;helps&lt;/I&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;I&gt;Accept it as the solution&lt;/I&gt;&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2024 06:51:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Different-result-when-using-Measure-as-a-variable-vs-using-a/m-p/3978801#M154271</guid>
      <dc:creator>Devender_Power</dc:creator>
      <dc:date>2024-06-07T06:51:01Z</dc:date>
    </item>
  </channel>
</rss>

