<?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 Defining a measure using another measure vs. using a var carrying the value of that measure in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Defining-a-measure-using-another-measure-vs-using-a-var-carrying/m-p/4100231#M162708</link>
    <description>&lt;P&gt;Why the below measure is giving me the error:&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&lt;FONT color="#808080"&gt;&lt;STRONG&gt;&lt;EM&gt;"A function 'PLACEHOLDER' has been used in a True/False expression that is used as a table filter expression. This is not allowed."&lt;/EM&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;chk RunWD&lt;/STRONG&gt;&lt;/FONT&gt; =&lt;BR /&gt;VAR &lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;fdt = [chk FDate]&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;VAR Result =&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;CALCULATE(&lt;BR /&gt;COUNTROWS(DimWDates),&lt;BR /&gt;DimWDates[Date] &amp;gt; &lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;[chk FDate]&lt;/FONT&gt;&lt;/STRONG&gt;,&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;STRONG&gt;&lt;FONT color="#FF00FF"&gt;--&amp;gt; returned error!&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;DimWDates[Date] &amp;lt;= TODAY()&lt;BR /&gt;)&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;RETURN Result&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;While the below is working fine, although they look the same!!! Just defined the measure as a variable!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;chk RunWD&lt;/STRONG&gt;&lt;/FONT&gt; =&lt;BR /&gt;VAR &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;fdt = [chk FDate]&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;VAR Result =&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;CALCULATE(&lt;BR /&gt;COUNTROWS(DimWDates),&lt;BR /&gt;DimWDates[Date] &amp;gt; &lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;fdt&lt;/FONT&gt;&lt;/STRONG&gt;,&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;STRONG&gt;&lt;FONT color="#339966"&gt;--&amp;gt; worked fine!!!&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;DimWDates[Date] &amp;lt;= TODAY()&lt;BR /&gt;)&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;RETURN Result&lt;/P&gt;</description>
    <pubDate>Wed, 14 Aug 2024 12:39:50 GMT</pubDate>
    <dc:creator>AhmadBakr</dc:creator>
    <dc:date>2024-08-14T12:39:50Z</dc:date>
    <item>
      <title>Defining a measure using another measure vs. using a var carrying the value of that measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Defining-a-measure-using-another-measure-vs-using-a-var-carrying/m-p/4100231#M162708</link>
      <description>&lt;P&gt;Why the below measure is giving me the error:&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&lt;FONT color="#808080"&gt;&lt;STRONG&gt;&lt;EM&gt;"A function 'PLACEHOLDER' has been used in a True/False expression that is used as a table filter expression. This is not allowed."&lt;/EM&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;chk RunWD&lt;/STRONG&gt;&lt;/FONT&gt; =&lt;BR /&gt;VAR &lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;fdt = [chk FDate]&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;VAR Result =&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;CALCULATE(&lt;BR /&gt;COUNTROWS(DimWDates),&lt;BR /&gt;DimWDates[Date] &amp;gt; &lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;[chk FDate]&lt;/FONT&gt;&lt;/STRONG&gt;,&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;STRONG&gt;&lt;FONT color="#FF00FF"&gt;--&amp;gt; returned error!&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;DimWDates[Date] &amp;lt;= TODAY()&lt;BR /&gt;)&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;RETURN Result&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;While the below is working fine, although they look the same!!! Just defined the measure as a variable!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;chk RunWD&lt;/STRONG&gt;&lt;/FONT&gt; =&lt;BR /&gt;VAR &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;fdt = [chk FDate]&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;VAR Result =&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;CALCULATE(&lt;BR /&gt;COUNTROWS(DimWDates),&lt;BR /&gt;DimWDates[Date] &amp;gt; &lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;fdt&lt;/FONT&gt;&lt;/STRONG&gt;,&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;STRONG&gt;&lt;FONT color="#339966"&gt;--&amp;gt; worked fine!!!&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;DimWDates[Date] &amp;lt;= TODAY()&lt;BR /&gt;)&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;RETURN Result&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2024 12:39:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Defining-a-measure-using-another-measure-vs-using-a-var-carrying/m-p/4100231#M162708</guid>
      <dc:creator>AhmadBakr</dc:creator>
      <dc:date>2024-08-14T12:39:50Z</dc:date>
    </item>
    <item>
      <title>Re: Defining a measure using another measure vs. using a var carrying the value of that measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Defining-a-measure-using-another-measure-vs-using-a-var-carrying/m-p/4100244#M162709</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="653509" data-lia-user-login="AhmadBakr" class="lia-mention lia-mention-user"&gt;AhmadBakr&lt;/a&gt;&amp;nbsp;Probably has something to do with CALCULATE and measures in filter clauses. What does this do?&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;chk RunWD =
VAR fdt = [chk FDate]
VAR Result = COUNTROWS( FILTER( 'DimWDates', [Date] &amp;gt; [chk FDate] &amp;amp;&amp;amp; [Date] &amp;lt;= TODAY() ) )
RETURN
Result&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 14 Aug 2024 12:59:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Defining-a-measure-using-another-measure-vs-using-a-var-carrying/m-p/4100244#M162709</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2024-08-14T12:59:21Z</dc:date>
    </item>
    <item>
      <title>Re: Defining a measure using another measure vs. using a var carrying the value of that measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Defining-a-measure-using-another-measure-vs-using-a-var-carrying/m-p/4100284#M162711</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="313" data-lia-user-login="Greg_Deckler" class="lia-mention lia-mention-user"&gt;Greg_Deckler&lt;/a&gt;&amp;nbsp;, thank you for your response.&lt;BR /&gt;&lt;BR /&gt;I was thinking of the same approach, in fact&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It worked! no errors &lt;span class="lia-unicode-emoji" title=":heavy_check_mark:"&gt;✔️&lt;/span&gt;&lt;span class="lia-unicode-emoji" title=":heavy_check_mark:"&gt;✔️&lt;/span&gt;&lt;span class="lia-unicode-emoji" title=":heavy_check_mark:"&gt;✔️&lt;/span&gt;, same as defining a VAR.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, this still does not answer the question: Why using the measure directly in the calculate filter argument returns an error!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried checking chatgpt and it gave me a strange explanation:&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;"&lt;FONT face="simsun,hei"&gt;In the first case, [chk FDate] is a measure and is directly used in the filter expressions. When you use a measure directly inside a CALCULATE filter argument, DAX expects it to be a valid True/False expression. However, measures often return scalar values rather than Boolean values, causing this error.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&lt;FONT face="simsun,hei"&gt;While in the second, the value of [chk FDate] is first stored in the variable fdt. Since fdt is now a scalar value (the result of the measure [chk FDate]), it can be safely used in the CALCULATE function as part of the filter expressions.&lt;/FONT&gt;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&lt;FONT face="times new roman,times"&gt;&lt;FONT face="simsun,hei"&gt;When you assign the result of a measure to a variable, you’re effectively converting the measure into a constant value that DAX can use as part of a logical comparison. Without this step, DAX tries to interpret the measure itself as a condition, which leads to the error&lt;/FONT&gt;.&lt;/FONT&gt;"&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;chatgpt's answer means that DAX did not interpret the value of the measure, which is weird - if true.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2024 13:16:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Defining-a-measure-using-another-measure-vs-using-a-var-carrying/m-p/4100284#M162711</guid>
      <dc:creator>AhmadBakr</dc:creator>
      <dc:date>2024-08-14T13:16:07Z</dc:date>
    </item>
  </channel>
</rss>

