<?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: Count distinct with priority in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-distinct-with-priority/m-p/3028998#M103425</link>
    <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="403972" data-lia-user-login="v-jianboli-msft" class="lia-mention lia-mention-user"&gt;v-jianboli-msft&lt;/a&gt;&amp;nbsp;, work great!&lt;/P&gt;</description>
    <pubDate>Wed, 18 Jan 2023 15:09:18 GMT</pubDate>
    <dc:creator>rdnguyen</dc:creator>
    <dc:date>2023-01-18T15:09:18Z</dc:date>
    <item>
      <title>Count distinct with priority</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-distinct-with-priority/m-p/3020367#M102737</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;
&lt;P&gt;I have a list of items that I did count for late delivery and on time delivery. It means the item could be in both category Late and On-time. By doing the count for each category, I realized the total was over calculated. For example, I counted Item A has &lt;STRONG&gt;1 "late", 2 "on-time"&lt;/STRONG&gt;, but would be considered "late" in overall.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How could I add this filter condition while counting on-time for not including this item?&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jan 2023 22:32:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-distinct-with-priority/m-p/3020367#M102737</guid>
      <dc:creator>rdnguyen</dc:creator>
      <dc:date>2023-01-13T22:32:10Z</dc:date>
    </item>
    <item>
      <title>Re: Count distinct with priority</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-distinct-with-priority/m-p/3020496#M102741</link>
      <description>&lt;P&gt;hello &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="361409" data-lia-user-login="rdnguyen" class="lia-mention lia-mention-user"&gt;rdnguyen&lt;/a&gt;&amp;nbsp;can you please provide with more detail or sample?&lt;/P&gt;</description>
      <pubDate>Sat, 14 Jan 2023 00:33:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-distinct-with-priority/m-p/3020496#M102741</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-01-14T00:33:59Z</dc:date>
    </item>
    <item>
      <title>Re: Count distinct with priority</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-distinct-with-priority/m-p/3020694#M102752</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="361409" data-lia-user-login="rdnguyen" class="lia-mention lia-mention-user"&gt;rdnguyen&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;you need to iterate over "items" like&lt;/P&gt;
&lt;P&gt;SUMX (&lt;/P&gt;
&lt;P&gt;VALUES ( 'Table'[Item Name] ),&lt;/P&gt;
&lt;P&gt;[Count Measure]&amp;nbsp;&lt;/P&gt;
&lt;P&gt;)&lt;/P&gt;</description>
      <pubDate>Sat, 14 Jan 2023 08:08:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-distinct-with-priority/m-p/3020694#M102752</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-01-14T08:08:17Z</dc:date>
    </item>
    <item>
      <title>Re: Count distinct with priority</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-distinct-with-priority/m-p/3022292#M102896</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="361409" data-lia-user-login="rdnguyen" class="lia-mention lia-mention-user"&gt;rdnguyen&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Based on your description, I have created a simple sample:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Please try:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Late = 
var _a = SUMMARIZE('Table',[ID],"Flag",IF("Late" in SELECTCOLUMNS(FILTER(ALL('Table'),[ID]=EARLIER('Table'[ID])),"Category",[Category]),"Late","On-Time"))
return COUNTX(FILTER(_a,[Flag]="Late"),[Flag])

On-Time = 
var _a = SUMMARIZE('Table',[ID],"Flag",IF("Late" in SELECTCOLUMNS(FILTER(ALL('Table'),[ID]=EARLIER('Table'[ID])),"Category",[Category]),"Late","On-Time"))
return COUNTX(FILTER(_a,[Flag]="On-Time"),[Flag])&lt;/LI-CODE&gt;
&lt;P&gt;Final output:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P style="background: white; margin: 7.5pt 0in 0in 0in;"&gt;&lt;SPAN&gt;Best Regards,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="background: white; margin: 7.5pt 0in 0in 0in;"&gt;&lt;SPAN&gt;Jianbo Li&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="background: white; margin: 7.5pt 0in 0in 0in;"&gt;&lt;SPAN&gt;If this post&amp;nbsp;&lt;STRONG&gt;&lt;I&gt;helps&lt;/I&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;I&gt;Accept it as the solution&lt;/I&gt;&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jan 2023 06:07:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-distinct-with-priority/m-p/3022292#M102896</guid>
      <dc:creator>v-jianboli-msft</dc:creator>
      <dc:date>2023-01-16T06:07:29Z</dc:date>
    </item>
    <item>
      <title>Re: Count distinct with priority</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-distinct-with-priority/m-p/3028998#M103425</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="403972" data-lia-user-login="v-jianboli-msft" class="lia-mention lia-mention-user"&gt;v-jianboli-msft&lt;/a&gt;&amp;nbsp;, work great!&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2023 15:09:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-distinct-with-priority/m-p/3028998#M103425</guid>
      <dc:creator>rdnguyen</dc:creator>
      <dc:date>2023-01-18T15:09:18Z</dc:date>
    </item>
  </channel>
</rss>

