<?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: Comparison works weird in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Comparison-works-weird/m-p/948685#M10500</link>
    <description>&lt;P&gt;After replacing a typo in the last row&amp;nbsp;&lt;SPAN&gt;__readySourcesCount = __allSources&lt;/SPAN&gt;&lt;STRONG&gt;Count&lt;/STRONG&gt; and using actual table/column names, the result is again incorrect.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also the issue is not related to decimal vs. whole number comparison as it evaluates to false (for calculated column) even for rows where e.g. total sources = 1, format ready sources = 1 and there is a 1/1 division before comparing to 1&lt;BR /&gt;&lt;BR /&gt;See the screenshot&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 26 Feb 2020 11:12:57 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2020-02-26T11:12:57Z</dc:date>
    <item>
      <title>Comparison works weird</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Comparison-works-weird/m-p/948645#M10494</link>
      <description>&lt;P&gt;The model contains of two tables/entities (note the terms are terms from the model, not from power BI itself):&lt;BR /&gt;- indicator&lt;BR /&gt;- data source&lt;BR /&gt;&lt;BR /&gt;"indicator" is linked to "data source" as one-to-many: multiple data sources might be needed for a certain indicator. Each "data source" has a status - wherever it has or has not data model designed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"data source" has following measures defined:&lt;BR /&gt;- total sources (=DISTINCTCOUNT(sources[ID]))&lt;/P&gt;&lt;P&gt;- format-ready sources (=CALCULATE(DISTINCTCOUNT(sources[ID]); sources[status] IN {"ModelReady"})&lt;BR /&gt;- % of format-ready sources (=sources[format-ready sources]/sources[total sources])&lt;BR /&gt;&lt;BR /&gt;Now we need to tell wherever an "indicator" is format-ready or not. Obviously, it is ready when all of its data sources are ready, in other words, when '% of format-ready sources' measure equals to 100%.&lt;BR /&gt;&lt;BR /&gt;So we use the formula within "indicator" table: &lt;STRONG&gt;IsDataReady = (sources[% of format-ready sources] = 1)&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;The problem:&lt;BR /&gt;- if we define a CALCULATED COLUMN with this formula, it does not work (returns incorrect false values)&lt;BR /&gt;- if we defined a MEASURE with exactly the same formula, it works as expected&lt;BR /&gt;&lt;BR /&gt;Why we see this as a problem: from the business prospective, the attribute defining wherever a certain indicator is data-ready or not is not a measure over the range of indicators, it is and should be exactly the calculated attribute of an indicator; any aggregations can not and should not be applied to it. It's not a measure. It must be a calculated column - but it does not work being a calculated column.&lt;BR /&gt;&lt;BR /&gt;Any ideas?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Feb 2020 10:39:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Comparison-works-weird/m-p/948645#M10494</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-02-26T10:39:07Z</dc:date>
    </item>
    <item>
      <title>Re: Comparison works weird</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Comparison-works-weird/m-p/948667#M10495</link>
      <description>&lt;LI-CODE lang="markup"&gt;// Don't use floating-point arithmetic if you don't have to. It's inaccurate by nature so
// equality should never be performed on such numbers.
 
// And here's your column:

[IsDataReady] = // calculated column in indicator
var __allSources = RELATEDTABLE( 'sources' )
var __allSourcesCount = COUNTROWS( __allSources )
var __readySources =
	filter(
		__allSources,
		sources[status] = "ModelReady"
	)
var __readySourcesCount =
	COUNTROWS( __readySources )
RETURN
	__readySourcesCount = __allSources&lt;/LI-CODE&gt;
&lt;P&gt;Best&lt;/P&gt;
&lt;P&gt;D&lt;/P&gt;</description>
      <pubDate>Wed, 26 Feb 2020 10:51:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Comparison-works-weird/m-p/948667#M10495</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-02-26T10:51:37Z</dc:date>
    </item>
    <item>
      <title>Re: Comparison works weird</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Comparison-works-weird/m-p/948685#M10500</link>
      <description>&lt;P&gt;After replacing a typo in the last row&amp;nbsp;&lt;SPAN&gt;__readySourcesCount = __allSources&lt;/SPAN&gt;&lt;STRONG&gt;Count&lt;/STRONG&gt; and using actual table/column names, the result is again incorrect.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also the issue is not related to decimal vs. whole number comparison as it evaluates to false (for calculated column) even for rows where e.g. total sources = 1, format ready sources = 1 and there is a 1/1 division before comparing to 1&lt;BR /&gt;&lt;BR /&gt;See the screenshot&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Feb 2020 11:12:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Comparison-works-weird/m-p/948685#M10500</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-02-26T11:12:57Z</dc:date>
    </item>
    <item>
      <title>Re: Comparison works weird</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Comparison-works-weird/m-p/948723#M10505</link>
      <description>First, the formula is not a measure. It's a calculated column formula. Second, I don't know your model's structure and data. Probably you have to make sure that you count distinct 'something' in source.&lt;BR /&gt;&lt;BR /&gt;It looks like you're trying to use it in a visual as a measure... I'm confused.&lt;BR /&gt;&lt;BR /&gt;Best&lt;BR /&gt;D</description>
      <pubDate>Wed, 26 Feb 2020 11:27:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Comparison-works-weird/m-p/948723#M10505</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-02-26T11:27:47Z</dc:date>
    </item>
    <item>
      <title>Re: Comparison works weird</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Comparison-works-weird/m-p/948726#M10506</link>
      <description>It's also possible that you are not following best practices... and hence the problems.&lt;BR /&gt;&lt;BR /&gt;Best&lt;BR /&gt;D</description>
      <pubDate>Wed, 26 Feb 2020 11:28:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Comparison-works-weird/m-p/948726#M10506</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-02-26T11:28:50Z</dc:date>
    </item>
    <item>
      <title>Re: Comparison works weird</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Comparison-works-weird/m-p/948731#M10507</link>
      <description>Why don't you do&lt;BR /&gt;&lt;BR /&gt;[IsFormatReady] = ([Total Sources] = [format-ready sources] ?&lt;BR /&gt;&lt;BR /&gt;This should give you exactly what you need....&lt;BR /&gt;&lt;BR /&gt;Best&lt;BR /&gt;D</description>
      <pubDate>Wed, 26 Feb 2020 11:31:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Comparison-works-weird/m-p/948731#M10507</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-02-26T11:31:05Z</dc:date>
    </item>
    <item>
      <title>Re: Comparison works weird</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Comparison-works-weird/m-p/948749#M10509</link>
      <description>&lt;P&gt;Using this &lt;SPAN&gt;[IsFormatReady] = ([Total Sources] = [format-ready sources]) provides exactly the same results:&lt;BR /&gt;- it works correct if formula is used as a definition of a measure&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;- it doesn't work if the same formula is used as a definition of a calculated column&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Feb 2020 11:45:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Comparison-works-weird/m-p/948749#M10509</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-02-26T11:45:07Z</dc:date>
    </item>
    <item>
      <title>Re: Comparison works weird</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Comparison-works-weird/m-p/948750#M10510</link>
      <description>&lt;P&gt;"you are not following best practices"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Not following what exactly?&lt;/P&gt;</description>
      <pubDate>Wed, 26 Feb 2020 11:45:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Comparison-works-weird/m-p/948750#M10510</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-02-26T11:45:56Z</dc:date>
    </item>
    <item>
      <title>Re: Comparison works weird</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Comparison-works-weird/m-p/948774#M10514</link>
      <description>The principles of dimensional design. Too much to talk about.&lt;BR /&gt;&lt;BR /&gt;I can assure you 100% that If you have a dimension with unique members and this dimension is connected 1:* to a fact table and you have 2 measures, [A] and [B], that work correctly for each and every member of the dimension, then a calc column of the form ([A] = [B]) must OUT OF NECESSITY return the correct result.&lt;BR /&gt;&lt;BR /&gt;If it does not, then there must be something wrong with the model.&lt;BR /&gt;&lt;BR /&gt;Best&lt;BR /&gt;D</description>
      <pubDate>Wed, 26 Feb 2020 11:59:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Comparison-works-weird/m-p/948774#M10514</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-02-26T11:59:21Z</dc:date>
    </item>
  </channel>
</rss>

