<?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: Counting rows based on a row wise measure via an unrelated table in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-rows-based-on-a-row-wise-measure-via-an-unrelated-table/m-p/1366304#M24799</link>
    <description>&lt;P&gt;Update: I am attaching the PowerBI file for reference:&amp;nbsp;&lt;A href="https://www.dropbox.com/s/z2iziyyk52xe0v3/PowerBI%20Report.pbix?dl=0" target="_blank" rel="noopener"&gt;PowerBI Report.pbix&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This calculation should work but for some reason it doesn't want to work. Either I'm missing something very obvious or this has to do something with the misterious internal workings of DAX.&lt;/P&gt;</description>
    <pubDate>Sat, 12 Sep 2020 16:54:42 GMT</pubDate>
    <dc:creator>zaza</dc:creator>
    <dc:date>2020-09-12T16:54:42Z</dc:date>
    <item>
      <title>Counting rows based on a row wise measure via an unrelated table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-rows-based-on-a-row-wise-measure-via-an-unrelated-table/m-p/1366216#M24798</link>
      <description>&lt;P&gt;I have daily stock data and I use a measure to calculate the daily range:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Daily Range = 
    SUMX ( 
        'Daily', 
        ROUNDUP ( 
            DIVIDE ( 
                'Daily'[Close] - 'Daily'[Open], 
                'Daily'[Open], 
                BLANK() 
            ), 
            2 
        )
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now I would like to count the number of occurences at each 2 decimal place. For this first I create a table:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Bins = GENERATESERIES ( -0.07, 0.06, 0.01 )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And then I use a measure to count the occurrences:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Range Count = 
    CALCULATE ( 
        COUNTROWS ( 'Daily' ), 
        FILTER ( 'Daily', [Daily Range] = SELECTEDVALUE ( 'Bins'[Value], BLANK() ) ) 
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However for some reason this doesn't work properly. I get impartial results:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As you can see I have plenty of historical values and if I create a calculated column instead, everything works perfectly. I need to do this via measures and prefarable not use Summarize function.&lt;/P&gt;</description>
      <pubDate>Sat, 12 Sep 2020 14:07:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-rows-based-on-a-row-wise-measure-via-an-unrelated-table/m-p/1366216#M24798</guid>
      <dc:creator>zaza</dc:creator>
      <dc:date>2020-09-12T14:07:25Z</dc:date>
    </item>
    <item>
      <title>Re: Counting rows based on a row wise measure via an unrelated table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-rows-based-on-a-row-wise-measure-via-an-unrelated-table/m-p/1366304#M24799</link>
      <description>&lt;P&gt;Update: I am attaching the PowerBI file for reference:&amp;nbsp;&lt;A href="https://www.dropbox.com/s/z2iziyyk52xe0v3/PowerBI%20Report.pbix?dl=0" target="_blank" rel="noopener"&gt;PowerBI Report.pbix&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This calculation should work but for some reason it doesn't want to work. Either I'm missing something very obvious or this has to do something with the misterious internal workings of DAX.&lt;/P&gt;</description>
      <pubDate>Sat, 12 Sep 2020 16:54:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-rows-based-on-a-row-wise-measure-via-an-unrelated-table/m-p/1366304#M24799</guid>
      <dc:creator>zaza</dc:creator>
      <dc:date>2020-09-12T16:54:42Z</dc:date>
    </item>
    <item>
      <title>Re: Counting rows based on a row wise measure via an unrelated table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-rows-based-on-a-row-wise-measure-via-an-unrelated-table/m-p/1366371#M24804</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="149408" data-lia-user-login="zaza" class="lia-mention lia-mention-user"&gt;zaza&lt;/a&gt;&amp;nbsp;Highly likely decimal numbers mess up the result. I tried it like this,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Range Count = 
    CALCULATE ( 
        COUNTROWS ( 'Daily' ), 
        FILTER ( 'Daily', INT( [Daily Range] * 100 ) = INT (SELECTEDVALUE ( 'Bins'[Value], BLANK() ) * 100) )
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the result looks more reasonable then; but I haven't come up with a sophisticated solution for the moment.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PS: Unless for some special reason, I didn't see the point summing up daily percentage ([Daily Range]); I'd author the measure this way,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Daily Range =
VAR __open = MAX ( Daily[Open] )
VAR __close = MAX ( Daily[Close] )
RETURN
    ROUNDUP ( DIVIDE ( __close - __open, __open, BLANK () ), 2 )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;[Range Count] might be simplified as&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;COUNTROWS (
    FILTER (
        Daily, INT ( [Daily Range] * 100 ) = INT ( MAX ( 'Bins'[Value] ) * 100 )
    )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 12 Sep 2020 18:38:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-rows-based-on-a-row-wise-measure-via-an-unrelated-table/m-p/1366371#M24804</guid>
      <dc:creator>CNENFRNL</dc:creator>
      <dc:date>2020-09-12T18:38:54Z</dc:date>
    </item>
    <item>
      <title>Re: Counting rows based on a row wise measure via an unrelated table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-rows-based-on-a-row-wise-measure-via-an-unrelated-table/m-p/1366593#M24811</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="250150" data-lia-user-login="CNENFRNL" class="lia-mention lia-mention-user"&gt;CNENFRNL&lt;/a&gt;&amp;nbsp;Thanks this works, but as you pointed out this still gives back impartial results. There is no reason why the formulas shouldn't work. I also thought initially that this might be due to the decimals but that is why I round the numbers up. However it still doesn't work&lt;/P&gt;</description>
      <pubDate>Sun, 13 Sep 2020 07:43:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-rows-based-on-a-row-wise-measure-via-an-unrelated-table/m-p/1366593#M24811</guid>
      <dc:creator>zaza</dc:creator>
      <dc:date>2020-09-13T07:43:34Z</dc:date>
    </item>
  </channel>
</rss>

