<?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 DistinctCount where Count &amp;gt; Than X in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DistinctCount-where-Count-gt-Than-X/m-p/1617217#M32601</link>
    <description>&lt;P&gt;Hey all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm having trouble getting my measure to work correctly. I have a fact table that looks like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;TestID&lt;/TD&gt;&lt;TD&gt;StudentID&lt;/TD&gt;&lt;TD&gt;Date&lt;/TD&gt;&lt;TD&gt;Result&lt;/TD&gt;&lt;TD&gt;In Period&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;3/1/20&lt;/TD&gt;&lt;TD&gt;Fail&lt;/TD&gt;&lt;TD&gt;Yes&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;8/4/20&lt;/TD&gt;&lt;TD&gt;Fail&lt;/TD&gt;&lt;TD&gt;Yes&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;1/1/19&lt;/TD&gt;&lt;TD&gt;Pass&lt;/TD&gt;&lt;TD&gt;Yes&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It's related to my User Dim table with cross filtering set to both.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to get my measure to calculate a distinctcount of students who failed a test more than once in a 12 month period.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My current formula is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Repeat Risk Users = 

var timesfailed = CALCULATE(COUNT('Fact Test Details'[TestID]),'Fact Test Details'[Result]="Fail",'Fact Test Details'[In Period]="Yes")

var repeatfail = CALCULATE(DISTINCTCOUNT('Fact Test Details'[StudentID]),FILTER('Fact Test Details',timesfailed&amp;gt;1))

Return
repeatfail&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried different variations of this, including trying a var summarize table, but nothing is giving me accurate numbers.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;var timesfailed is giving the correct count of failures, but var repeatfail is giving an inaccurate result--way to high. No matter what i change the Filter timesfailed greater than to, the number is the same, unless I change it to =0.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Not sure what is wrong. Any suggestions would be awesome!&lt;/P&gt;</description>
    <pubDate>Fri, 22 Jan 2021 15:59:03 GMT</pubDate>
    <dc:creator>StephenK</dc:creator>
    <dc:date>2021-01-22T15:59:03Z</dc:date>
    <item>
      <title>DistinctCount where Count &gt; Than X</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DistinctCount-where-Count-gt-Than-X/m-p/1617217#M32601</link>
      <description>&lt;P&gt;Hey all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm having trouble getting my measure to work correctly. I have a fact table that looks like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;TestID&lt;/TD&gt;&lt;TD&gt;StudentID&lt;/TD&gt;&lt;TD&gt;Date&lt;/TD&gt;&lt;TD&gt;Result&lt;/TD&gt;&lt;TD&gt;In Period&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;3/1/20&lt;/TD&gt;&lt;TD&gt;Fail&lt;/TD&gt;&lt;TD&gt;Yes&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;8/4/20&lt;/TD&gt;&lt;TD&gt;Fail&lt;/TD&gt;&lt;TD&gt;Yes&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;1/1/19&lt;/TD&gt;&lt;TD&gt;Pass&lt;/TD&gt;&lt;TD&gt;Yes&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It's related to my User Dim table with cross filtering set to both.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to get my measure to calculate a distinctcount of students who failed a test more than once in a 12 month period.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My current formula is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Repeat Risk Users = 

var timesfailed = CALCULATE(COUNT('Fact Test Details'[TestID]),'Fact Test Details'[Result]="Fail",'Fact Test Details'[In Period]="Yes")

var repeatfail = CALCULATE(DISTINCTCOUNT('Fact Test Details'[StudentID]),FILTER('Fact Test Details',timesfailed&amp;gt;1))

Return
repeatfail&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried different variations of this, including trying a var summarize table, but nothing is giving me accurate numbers.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;var timesfailed is giving the correct count of failures, but var repeatfail is giving an inaccurate result--way to high. No matter what i change the Filter timesfailed greater than to, the number is the same, unless I change it to =0.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Not sure what is wrong. Any suggestions would be awesome!&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jan 2021 15:59:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DistinctCount-where-Count-gt-Than-X/m-p/1617217#M32601</guid>
      <dc:creator>StephenK</dc:creator>
      <dc:date>2021-01-22T15:59:03Z</dc:date>
    </item>
    <item>
      <title>Re: DistinctCount where Count &gt; Than X</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DistinctCount-where-Count-gt-Than-X/m-p/1617367#M32609</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="210286" data-lia-user-login="StephenK" class="lia-mention lia-mention-user"&gt;StephenK&lt;/a&gt; , Create a measure like this and use with StudentID&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;countx(summarize(Table, Table[StudentID], "_1", calculate(distinctcount(Table[TestID]), Table[Result]="Fail" &amp;amp;&amp;amp; Table[In Period]="Yes")),[_1]&amp;gt;1)&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jan 2021 17:15:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DistinctCount-where-Count-gt-Than-X/m-p/1617367#M32609</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2021-01-22T17:15:42Z</dc:date>
    </item>
    <item>
      <title>Re: DistinctCount where Count &gt; Than X</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DistinctCount-where-Count-gt-Than-X/m-p/1617434#M32612</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="148838" data-lia-user-login="amitchandak" class="lia-mention lia-mention-user"&gt;amitchandak&lt;/a&gt;&amp;nbsp; thanks for the response! This doesn't seem to work for me.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Repeat Failed =

COUNTX(SUMMARIZE('Fact Test Details','Fact Test Details'[StudentID],"TimesFailed",CALCULATE(DISTINCTCOUNT('Fact Test Details'[TestID]),FILTER('Fact Test Details','Fact Test Details'[Result]="Fail" &amp;amp;&amp;amp; 'Fact Test Details'[In Period]="Yes"))),[TimesFailed]&amp;gt;1)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get an error saying "The function COUNTX cannot work with values of type Boolean."&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jan 2021 17:56:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DistinctCount-where-Count-gt-Than-X/m-p/1617434#M32612</guid>
      <dc:creator>StephenK</dc:creator>
      <dc:date>2021-01-22T17:56:35Z</dc:date>
    </item>
    <item>
      <title>Re: DistinctCount where Count &gt; Than X</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DistinctCount-where-Count-gt-Than-X/m-p/1617570#M32617</link>
      <description>&lt;P&gt;Looks like I got it working with this formula:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Times Failed = CALCULATE(COUNT('Fact Test Details'[TestID]),'Fact Test Details'[Result]="Fail",'Fact Test Details'[In Period]="Yes")


Repeat Failed =

Var FailCount = ADDCOLUMNS(SUMMARIZE('Fact Test Details','Fact Test Details'[StudentID]),"TimesFailed",[Times Failed])

Var _1 = FILTER(FailCount,[TimesFailed]&amp;gt;1)

Return COUNTROWS(_1)&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 22 Jan 2021 20:16:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DistinctCount-where-Count-gt-Than-X/m-p/1617570#M32617</guid>
      <dc:creator>StephenK</dc:creator>
      <dc:date>2021-01-22T20:16:55Z</dc:date>
    </item>
    <item>
      <title>Re: DistinctCount where Count &gt; Than X</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DistinctCount-where-Count-gt-Than-X/m-p/1619424#M32680</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="210286" data-lia-user-login="StephenK" class="lia-mention lia-mention-user"&gt;StephenK&lt;/a&gt;&amp;nbsp;, Kudos to you.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jan 2021 02:11:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DistinctCount-where-Count-gt-Than-X/m-p/1619424#M32680</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2021-01-25T02:11:23Z</dc:date>
    </item>
  </channel>
</rss>

