<?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: Which DAX functions are correct? in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Which-DAX-functions-are-correct/m-p/2807045#M88628</link>
    <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;As near as I can dechiper, then it *should* be FILTER, AND, CALCULATE. I hate to say anything is correct about that DAX.&lt;/P&gt;</description>
    <pubDate>Thu, 29 Sep 2022 17:42:16 GMT</pubDate>
    <dc:creator>Greg_Deckler</dc:creator>
    <dc:date>2022-09-29T17:42:16Z</dc:date>
    <item>
      <title>Which DAX functions are correct?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Which-DAX-functions-are-correct/m-p/2806829#M88598</link>
      <description>&lt;P&gt;Hi, all together!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am referring to Question #44 which you can find&amp;nbsp;&lt;A href="https://www.examtopics.com/exams/microsoft/pl-300/view/15/" target="_self"&gt;here&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a bunch of questions to this exercise!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think the solution should be&lt;/P&gt;&lt;P&gt;FILTER&lt;/P&gt;&lt;P&gt;AND&lt;/P&gt;&lt;P&gt;ALL&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but have some problems with that (especially with the ALL).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Problem 1:&amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;The arguments in the AND function are columns, that is, all&lt;/P&gt;&lt;P&gt;'Transaction Size'[Min], 'Transaction Size'[Max] and also SalesTotal&lt;/P&gt;&lt;P&gt;are columns.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does this mean that AND goes through each entry of the columns separetely (how else should one compare two columns by &amp;lt; or &amp;gt;)?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Problem 2:&amp;nbsp;&lt;/STRONG&gt;Is ALL correct as the last option? I think CALCULATE is not possible as DISTINCT(column) returns a column and not an expression as needed for CALCULATE. But now comes my but:&lt;/P&gt;&lt;P&gt;If ALL is correct, then what is RETURN? It should be a table but the task was to build a calculated column...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Really confusing!&lt;/P&gt;</description>
      <pubDate>Thu, 29 Sep 2022 15:55:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Which-DAX-functions-are-correct/m-p/2806829#M88598</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-09-29T15:55:27Z</dc:date>
    </item>
    <item>
      <title>Re: Which DAX functions are correct?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Which-DAX-functions-are-correct/m-p/2806845#M88601</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;It's CALCULATE, ALL, FILTER although I would never construct that measure that way. I'm not even sure that the formula is actually valid or would even work as FILTER is going to return a table of values. Super awful DAX.&lt;/P&gt;
&lt;H1 id="filter"&gt;FILTER&lt;/H1&gt;
&lt;P&gt;Returns a table that represents a subset of another table or expression.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Sep 2022 16:07:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Which-DAX-functions-are-correct/m-p/2806845#M88601</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2022-09-29T16:07:31Z</dc:date>
    </item>
    <item>
      <title>Re: Which DAX functions are correct?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Which-DAX-functions-are-correct/m-p/2806855#M88602</link>
      <description>&lt;P&gt;Pretty sure it is CALCULATE. You can use a table expression like DISTINCT inside CALCULATE if you know it is only going to return a table with 1 row and 1 column - that gets converted to a scalar value. Their code is relying on the filtering to make sure that only 1 row gets returned from the Transaction Size table.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Sep 2022 16:12:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Which-DAX-functions-are-correct/m-p/2806855#M88602</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2022-09-29T16:12:50Z</dc:date>
    </item>
    <item>
      <title>Re: Which DAX functions are correct?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Which-DAX-functions-are-correct/m-p/2806923#M88606</link>
      <description>&lt;P&gt;You &lt;STRONG&gt;cannot&lt;/STRONG&gt; use a table function as the first argument to CALCULATE. It must be a scalar expression. A table expression will result in an error, even if the function would return one value (one col and one row) in the context. You have to use &lt;STRONG&gt;CALCULATETABLE&lt;/STRONG&gt; in this case.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Sep 2022 16:51:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Which-DAX-functions-are-correct/m-p/2806923#M88606</guid>
      <dc:creator>daXtreme</dc:creator>
      <dc:date>2022-09-29T16:51:42Z</dc:date>
    </item>
    <item>
      <title>Re: Which DAX functions are correct?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Which-DAX-functions-are-correct/m-p/2806951#M88610</link>
      <description>&lt;P&gt;&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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do not understand why&lt;/P&gt;&lt;P&gt;CALCULATE&lt;/P&gt;&lt;P&gt;ALL&lt;/P&gt;&lt;P&gt;FILTER&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;is correct.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Why is the first CALCULATE?&amp;nbsp;&lt;/P&gt;&lt;P&gt;'Transaction Size' is a table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Sep 2022 17:06:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Which-DAX-functions-are-correct/m-p/2806951#M88610</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-09-29T17:06:11Z</dc:date>
    </item>
    <item>
      <title>Re: Which DAX functions are correct?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Which-DAX-functions-are-correct/m-p/2806954#M88612</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Actually CALCULATE works just fine with VALUES and DISTINCT as long as the table returns one row. The engine automatically converts this table to a scalar value.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Sep 2022 17:06:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Which-DAX-functions-are-correct/m-p/2806954#M88612</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-09-29T17:06:43Z</dc:date>
    </item>
    <item>
      <title>Re: Which DAX functions are correct?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Which-DAX-functions-are-correct/m-p/2806971#M88614</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt;&amp;nbsp;Well, those are the correct answers according to if you Reveal Solution. I'm not saying any of it is correct. It's all trash DAX imho. But, according to the site, those are the "right" answers:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Sep 2022 17:12:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Which-DAX-functions-are-correct/m-p/2806971#M88614</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2022-09-29T17:12:58Z</dc:date>
    </item>
    <item>
      <title>Re: Which DAX functions are correct?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Which-DAX-functions-are-correct/m-p/2806978#M88615</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="240987" data-lia-user-login="johnt75" class="lia-mention lia-mention-user"&gt;johnt75&lt;/a&gt;&amp;nbsp;Ok, but I really do not see why this should be the case here as&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DISTINCT( 'Transaction Size'[Transaction Size]) is a column&lt;/P&gt;&lt;P&gt;and&lt;/P&gt;&lt;P&gt;FilterSegment is a table..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Sep 2022 17:15:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Which-DAX-functions-are-correct/m-p/2806978#M88615</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-09-29T17:15:56Z</dc:date>
    </item>
    <item>
      <title>Re: Which DAX functions are correct?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Which-DAX-functions-are-correct/m-p/2806984#M88617</link>
      <description>&lt;P&gt;&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; The given "correct" answer cannot be correct. This is why I am asking here if MY answer which I suggest in the original post is correct.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Sep 2022 17:18:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Which-DAX-functions-are-correct/m-p/2806984#M88617</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-09-29T17:18:46Z</dc:date>
    </item>
    <item>
      <title>Re: Which DAX functions are correct?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Which-DAX-functions-are-correct/m-p/2806993#M88619</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt;&amp;nbsp;The right answer is to dispose of all of that DAX and start over.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Sep 2022 17:26:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Which-DAX-functions-are-correct/m-p/2806993#M88619</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2022-09-29T17:26:02Z</dc:date>
    </item>
    <item>
      <title>Re: Which DAX functions are correct?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Which-DAX-functions-are-correct/m-p/2807014#M88622</link>
      <description>&lt;P&gt;&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; In general, I would agree. But I am in the situation to have to pass the PL-300 Exam and as far as I understood, this has been an original question in an earlier version of that exam and I try to use these questions for preparation. Therefore, I am interested to understand which solution is correct (independent of the question if the code is best practice or not).&lt;/P&gt;</description>
      <pubDate>Thu, 29 Sep 2022 17:31:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Which-DAX-functions-are-correct/m-p/2807014#M88622</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-09-29T17:31:31Z</dc:date>
    </item>
    <item>
      <title>Re: Which DAX functions are correct?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Which-DAX-functions-are-correct/m-p/2807045#M88628</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt;&amp;nbsp;As near as I can dechiper, then it *should* be FILTER, AND, CALCULATE. I hate to say anything is correct about that DAX.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Sep 2022 17:42:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Which-DAX-functions-are-correct/m-p/2807045#M88628</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2022-09-29T17:42:16Z</dc:date>
    </item>
    <item>
      <title>Re: Which DAX functions are correct?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Which-DAX-functions-are-correct/m-p/2807071#M88633</link>
      <description>&lt;P&gt;&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;&lt;/P&gt;&lt;P&gt;As far as I can say, the "solution" is either FILTER, AND, ALL or FILTER, AND, CALCULATE.&lt;/P&gt;&lt;P&gt;Problem: If you ask me, both do not work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Particularly, the task is to code a calculated table, this means that the measure has to give either "small", "medium" or "large".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But both answers do not do that and, moreoever, technically the arguments are not fitting, because FilterSegment is a table then and the DISTINCT function gives a column....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Maybe I should not insist to find the answer...&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Sep 2022 17:54:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Which-DAX-functions-are-correct/m-p/2807071#M88633</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-09-29T17:54:11Z</dc:date>
    </item>
    <item>
      <title>Re: Which DAX functions are correct?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Which-DAX-functions-are-correct/m-p/2807079#M88635</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt;&amp;nbsp;Actually, I tested this locally on a sample dataset, FILTER, AND, CALCULATE does in fact work. It only works though because the DISTINCT brings back a single row table that CALCULATE converts to a scalar value. 100%, FILTER, AND, CALCULATE works.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Sep 2022 17:54:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Which-DAX-functions-are-correct/m-p/2807079#M88635</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2022-09-29T17:54:50Z</dc:date>
    </item>
    <item>
      <title>Re: Which DAX functions are correct?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Which-DAX-functions-are-correct/m-p/2807085#M88636</link>
      <description>&lt;P&gt;&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; OKAY! Then I do not understand the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(1) 'Transaction Size'[Transaction Size] is a column, namely the column&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Transaction Size&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Small&lt;/P&gt;&lt;P&gt;Medium&lt;/P&gt;&lt;P&gt;Large&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Applying DISTINCT to it, should just give the same column.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(2) FilterSegment is a table since FILTER returns a table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(3) If I apply CALCULATE to these two arguments, I really do not see how this works.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Sep 2022 18:00:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Which-DAX-functions-are-correct/m-p/2807085#M88636</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-09-29T18:00:08Z</dc:date>
    </item>
    <item>
      <title>Re: Which DAX functions are correct?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Which-DAX-functions-are-correct/m-p/2807094#M88637</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt;&amp;nbsp;Well, no sane human being would construct that measure that way. All you need to do is MAXX(FilterSegment,[Transaction Size]). You have to read up on CALCULATE extremely closely to understand why this works:&amp;nbsp;&lt;A href="https://dax.guide/calculate/" target="_blank" rel="noopener"&gt;CALCULATE – DAX Guide&lt;/A&gt;. Some CALCULATE only DAX try hard worked overtime to get CALCULATE into that formula. It's utter nonsense. But, because CALCULATE evaluates the &lt;SPAN&gt;'Transaction Size'[Transaction Size] within the context of FilterSegment, which is a single row table, then the DISTINCT brings back a single row table of the [Transaction Size] that happens to correspond to the context of the single row table in FilterSegment, which is whatever transaction size the sales happen to fall into. It's black box, stupidly complicated nonsense and doesn't have to be nearly that difficult or obfuscated.&amp;nbsp;&lt;A href="https://www.youtube.com/watch?v=meh3OkgFYfc&amp;amp;t=24s" target="_blank" rel="noopener"&gt;MSHGQM - Don't Use CALCULATE! - YouTube&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Sep 2022 18:06:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Which-DAX-functions-are-correct/m-p/2807094#M88637</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2022-09-29T18:06:41Z</dc:date>
    </item>
    <item>
      <title>Re: Which DAX functions are correct?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Which-DAX-functions-are-correct/m-p/2808154#M88717</link>
      <description>&lt;P&gt;"&lt;SPAN&gt;DISTINCT( 'Transaction Size'[Transaction Size]) is a column" - yes it is, but in this instance the code has been crafted to try and guarantee that it will return a column of only one row. as another user posted, when you pass a table with a single column and a single row into a function which requires a scalar value the DAX engine automatically does the conversion.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;As another example, look at the difference between LASTDATE('Date'[Date]) and MAX('Date'[Date]). LASTDATE returns a table with a single row and a single column, MAX returns a scalar value. But you can still use LASTDATE as a scalar value ( even though you shouldn't ), because DAX will automatically make the conversion. The conversion does not work both ways though, it will not convert a scalar value into a table. You can check this on dax.do by running&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;EVALUATE
MAX ('Date'[Date] )

EVALUATE
LASTDATE ('Date'[Date] )&lt;/LI-CODE&gt;
&lt;P&gt;The first query will fail, because it does not return a table. The second query will work, because it does return a query.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"&lt;SPAN&gt;FilterSegment is a table." - all filters are tables, and you can use any table as a filter as long as it has the correct lineage.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Sep 2022 08:48:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Which-DAX-functions-are-correct/m-p/2808154#M88717</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2022-09-30T08:48:10Z</dc:date>
    </item>
  </channel>
</rss>

