<?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: Trying to filter out blank rows in a measure in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trying-to-filter-out-blank-rows-in-a-measure/m-p/2199818#M51622</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="282044" data-lia-user-login="Steveyd78" class="lia-mention lia-mention-user"&gt;Steveyd78&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;Try this&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Ratio =
// we know that there are 20 total rows, we know that Ryans row count is 4, 
//We know that the  distinct for all dates = 4, we know that Ryans Distinct Count = 2. So we want to get rid of the Dates proportionaly that Ryan is not listed on- therefore 4-2 = 2 and 2/4 = 50%
//Therefore 20*50% becomes the denominator, while the numerator is the Ryans DistinctCount //Countrows Ryan = Calculate(COUNTROWS('HoursTable'),'HoursTable'[Name] = "Ryan")
VAR _Ryan =
    CALCULATE ( COUNTROWS ( 'HoursTable' ), 'HoursTable'[Name] = "Ryan" ) //4
VAR _RyanDistinct =
    CALCULATE (
        DISTINCTCOUNT ( HoursTable[Date] ),
        FILTER ( HoursTable, HoursTable[Name] = "Ryan" )
    ) //2
VAR _allRows =
    COUNTROWS ( HoursTable ) //20
VAR _alldCount =
    DISTINCTCOUNT ( HoursTable[Date] ) //4
VAR _ratio =
    DIVIDE ( _alldCount - _RyanDistinct, _alldCount )
RETURN
    DIVIDE ( _Ryan, _allrows * _ratio )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Let me know if you have any questions.&lt;BR /&gt;&lt;BR /&gt;If this solves your issues, please mark it as the &lt;STRONG&gt;solution, &lt;/STRONG&gt;so that others can find it easily. &lt;STRONG&gt;Kudos &lt;/STRONG&gt;&lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;are nice too.&lt;BR /&gt;Nathaniel&lt;/P&gt;</description>
    <pubDate>Sun, 21 Nov 2021 02:51:29 GMT</pubDate>
    <dc:creator>Nathaniel_C</dc:creator>
    <dc:date>2021-11-21T02:51:29Z</dc:date>
    <item>
      <title>Trying to filter out blank rows in a measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trying-to-filter-out-blank-rows-in-a-measure/m-p/2199806#M51621</link>
      <description>&lt;P&gt;Ok so I have the feeling that is is really easy but it is driving me crazy ( I will paste the really simple data table at the end of this post).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My table has three columns - Date, Nae, Hours&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Want to create a percentage where I divide the count of the rows of a person by the total number of rows - that isn't an issue (see below)&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Now what I really want to do is for the total % for Ryan to be 40% not 20%, i.e. for the total % to NOT include the two blank rows where he didn't work. I CAN do this easily on the visalization by simply adding a filter where "Count Ryan" &amp;gt; 0:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Easy!! See It's now dividing by 10 not 20. Now I REALLY want to do this in a measure (so I can replicate for more people) but I have tried everything I can think of (which isn't much). The following does not work but shows the kind of thing I am trying. Intuitively I think this should be really easy but it's driving me bannanas so am asking for help!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;% Ryan days removed = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-180px"&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt; &lt;SPAN&gt;Count_Ryan&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;count&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Data[Name]&lt;/SPAN&gt;&lt;SPAN&gt;), &lt;/SPAN&gt;&lt;SPAN&gt;Data[Name]&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;"Ryan"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-180px"&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt; &lt;SPAN&gt;Count_Team_Total&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;count&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN&gt;Data[Name]&lt;/SPAN&gt;&lt;SPAN&gt;), &lt;/SPAN&gt;&lt;SPAN&gt;Data[Name]&lt;/SPAN&gt;&lt;SPAN&gt; &amp;lt;&amp;gt; &lt;/SPAN&gt;&lt;SPAN&gt;blank&lt;/SPAN&gt;&lt;SPAN&gt;())&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV class="lia-indent-padding-left-180px"&gt;&lt;SPAN&gt;RETURN&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV class="lia-indent-padding-left-180px"&gt;&lt;SPAN&gt;divide&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Count_Ryan&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-180px"&gt;&lt;SPAN&gt;Count_Team_Total&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-180px"&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-180px"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Anyway here is the data, nice and simple to cut and paste. Thanks in advance all!!&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Date&amp;nbsp; &amp;nbsp;Name&amp;nbsp; &amp;nbsp;Hours &lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;31-Mar-21&lt;/TD&gt;&lt;TD&gt;Steve&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;30-Apr-21&lt;/TD&gt;&lt;TD&gt;Steve&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;31-May-21&lt;/TD&gt;&lt;TD&gt;Steve&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;30-Jun-21&lt;/TD&gt;&lt;TD&gt;Steve&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;31-Mar-21&lt;/TD&gt;&lt;TD&gt;Ryan&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;30-Apr-21&lt;/TD&gt;&lt;TD&gt;Ryan&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&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TR&gt;&lt;TR&gt;&lt;TD&gt;30-Apr-21&lt;/TD&gt;&lt;TD&gt;Steve&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;31-May-21&lt;/TD&gt;&lt;TD&gt;Steve&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;30-Jun-21&lt;/TD&gt;&lt;TD&gt;Steve&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 21 Nov 2021 00:32:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trying-to-filter-out-blank-rows-in-a-measure/m-p/2199806#M51621</guid>
      <dc:creator>Steveyd78</dc:creator>
      <dc:date>2021-11-21T00:32:29Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to filter out blank rows in a measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trying-to-filter-out-blank-rows-in-a-measure/m-p/2199818#M51622</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="282044" data-lia-user-login="Steveyd78" class="lia-mention lia-mention-user"&gt;Steveyd78&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;Try this&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Ratio =
// we know that there are 20 total rows, we know that Ryans row count is 4, 
//We know that the  distinct for all dates = 4, we know that Ryans Distinct Count = 2. So we want to get rid of the Dates proportionaly that Ryan is not listed on- therefore 4-2 = 2 and 2/4 = 50%
//Therefore 20*50% becomes the denominator, while the numerator is the Ryans DistinctCount //Countrows Ryan = Calculate(COUNTROWS('HoursTable'),'HoursTable'[Name] = "Ryan")
VAR _Ryan =
    CALCULATE ( COUNTROWS ( 'HoursTable' ), 'HoursTable'[Name] = "Ryan" ) //4
VAR _RyanDistinct =
    CALCULATE (
        DISTINCTCOUNT ( HoursTable[Date] ),
        FILTER ( HoursTable, HoursTable[Name] = "Ryan" )
    ) //2
VAR _allRows =
    COUNTROWS ( HoursTable ) //20
VAR _alldCount =
    DISTINCTCOUNT ( HoursTable[Date] ) //4
VAR _ratio =
    DIVIDE ( _alldCount - _RyanDistinct, _alldCount )
RETURN
    DIVIDE ( _Ryan, _allrows * _ratio )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Let me know if you have any questions.&lt;BR /&gt;&lt;BR /&gt;If this solves your issues, please mark it as the &lt;STRONG&gt;solution, &lt;/STRONG&gt;so that others can find it easily. &lt;STRONG&gt;Kudos &lt;/STRONG&gt;&lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;are nice too.&lt;BR /&gt;Nathaniel&lt;/P&gt;</description>
      <pubDate>Sun, 21 Nov 2021 02:51:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trying-to-filter-out-blank-rows-in-a-measure/m-p/2199818#M51622</guid>
      <dc:creator>Nathaniel_C</dc:creator>
      <dc:date>2021-11-21T02:51:29Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to filter out blank rows in a measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trying-to-filter-out-blank-rows-in-a-measure/m-p/2199831#M51623</link>
      <description>&lt;P&gt;This should work for any of the names you pick:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;% of Team Hours = 
VAR NameHours = SUM ( Data[Hours] )
VAR TeamHours =
    CALCULATE ( SUM ( Data[Hours] ), VALUES ( Data[Date] ), ALL ( Data[Name] ) )
RETURN
    DIVIDE ( NameHours, TeamHours )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 21 Nov 2021 03:41:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trying-to-filter-out-blank-rows-in-a-measure/m-p/2199831#M51623</guid>
      <dc:creator>AlexisOlson</dc:creator>
      <dc:date>2021-11-21T03:41:17Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to filter out blank rows in a measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trying-to-filter-out-blank-rows-in-a-measure/m-p/2199837#M51624</link>
      <description>&lt;P&gt;That is just awesome - am going to work through code to work out what is going on (hopefully won't take me too long!)&lt;/P&gt;</description>
      <pubDate>Sun, 21 Nov 2021 04:08:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trying-to-filter-out-blank-rows-in-a-measure/m-p/2199837#M51624</guid>
      <dc:creator>Steveyd78</dc:creator>
      <dc:date>2021-11-21T04:08:47Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to filter out blank rows in a measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trying-to-filter-out-blank-rows-in-a-measure/m-p/2199838#M51625</link>
      <description>&lt;P&gt;That's amazing, really appreciated the comments - will definately help me work through the code!&lt;/P&gt;</description>
      <pubDate>Sun, 21 Nov 2021 04:10:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trying-to-filter-out-blank-rows-in-a-measure/m-p/2199838#M51625</guid>
      <dc:creator>Steveyd78</dc:creator>
      <dc:date>2021-11-21T04:10:28Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to filter out blank rows in a measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trying-to-filter-out-blank-rows-in-a-measure/m-p/2200009#M51634</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="282044" data-lia-user-login="Steveyd78" class="lia-mention lia-mention-user"&gt;Steveyd78&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;You are welcome, hope it works for you!&lt;/P&gt;
&lt;P&gt;Nathaniel&lt;/P&gt;</description>
      <pubDate>Sun, 21 Nov 2021 15:58:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trying-to-filter-out-blank-rows-in-a-measure/m-p/2200009#M51634</guid>
      <dc:creator>Nathaniel_C</dc:creator>
      <dc:date>2021-11-21T15:58:45Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to filter out blank rows in a measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trying-to-filter-out-blank-rows-in-a-measure/m-p/2200042#M51637</link>
      <description>&lt;P&gt;To get TeamHours, I use ALL ( Data[Name] ) to get all of the names (not just the one in the current filter context) but use VALUES ( Data[Date] ) to preserve the current Date filter context.&lt;/P&gt;</description>
      <pubDate>Sun, 21 Nov 2021 17:44:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trying-to-filter-out-blank-rows-in-a-measure/m-p/2200042#M51637</guid>
      <dc:creator>AlexisOlson</dc:creator>
      <dc:date>2021-11-21T17:44:55Z</dc:date>
    </item>
  </channel>
</rss>

