<?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: DIstinct count based on multiple conditons in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DIstinct-count-based-on-multiple-conditons/m-p/3440247#M130654</link>
    <description>&lt;P&gt;Thanks a lot.&lt;/P&gt;&lt;P&gt;For Result1 i used the below;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Distinct regions =&lt;/SPAN&gt; &lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;DISTINCTCOUNT&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Table'&lt;/SPAN&gt;&lt;SPAN&gt;[city]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;ALLEXCEPT&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Table'&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;'Table'&lt;/SPAN&gt;&lt;SPAN&gt;[customer]&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;'Table'&lt;/SPAN&gt;&lt;SPAN&gt;[Mth]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;which worked well..gave me the distinct number of cities the customers visited over the 8month period&lt;BR /&gt;&lt;BR /&gt;&lt;/DIV&gt;&lt;P&gt;2. a little modification to your second solution (result2) worked perfectly for me. However my table has 8 months. how do i modify the filter condition so that it considers all the months and not give me the results for just the maximum month. so that i can categorise (move 2 times, move 3 times, ..., move n times) for the distinct cities for all the customers over the 8 month period.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Wed, 20 Sep 2023 15:35:45 GMT</pubDate>
    <dc:creator>DeeA</dc:creator>
    <dc:date>2023-09-20T15:35:45Z</dc:date>
    <item>
      <title>DIstinct count based on multiple conditons</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DIstinct-count-based-on-multiple-conditons/m-p/3437179#M130442</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="507" data-lia-user-login="parry2k" class="lia-mention lia-mention-user"&gt;parry2k&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please assist;&lt;/P&gt;&lt;P&gt;I have a table that looks like below;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I want to be able to&lt;/P&gt;&lt;P&gt;1. countdistinct the number of cities per customer for each month for an output similar to below&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. For every month how do i show in a visual the count of movement like below;&lt;/P&gt;&lt;P&gt;&amp;nbsp;A distinct cities visited of 1 means static&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Sep 2023 22:48:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DIstinct-count-based-on-multiple-conditons/m-p/3437179#M130442</guid>
      <dc:creator>DeeA</dc:creator>
      <dc:date>2023-09-18T22:48:14Z</dc:date>
    </item>
    <item>
      <title>Re: DIstinct count based on multiple conditons</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DIstinct-count-based-on-multiple-conditons/m-p/3439081#M130552</link>
      <description>&lt;P&gt;Please provide sample data (with sensitive information removed) that covers your issue or question completely, in a usable format (not as a screenshot). Leave out anything not related to the issue.&lt;BR /&gt;&lt;A href="https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216" target="_blank"&gt;https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please note that Oklahoma is a state, not a city.&lt;BR /&gt;Please show the expected outcome based on the sample data you provided. &lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523" target="_blank"&gt;https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2023 01:47:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DIstinct-count-based-on-multiple-conditons/m-p/3439081#M130552</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2023-09-20T01:47:32Z</dc:date>
    </item>
    <item>
      <title>Re: DIstinct count based on multiple conditons</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DIstinct-count-based-on-multiple-conditons/m-p/3439283#M130574</link>
      <description>&lt;P&gt;Hi&amp;nbsp; &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="606145" data-lia-user-login="DeeA" class="lia-mention lia-mention-user"&gt;DeeA&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here are the steps you can follow：&lt;/P&gt;
&lt;P&gt;Question1:&lt;/P&gt;
&lt;P&gt;1. Create measure.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Result1 =
COUNTX(
    FILTER(ALL('Table'),
    'Table'[Month]=MAX('Table'[Month])&amp;amp;&amp;amp;'Table'[Customer]=MAX('Table'[Customer])),[Cities visited])&lt;/LI-CODE&gt;
&lt;P&gt;2. Result:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Question2:&lt;/P&gt;
&lt;P&gt;1. Enter data – create a flag table.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;2. Create measure.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Result2 =
SWITCH(
    TRUE(),
    MAX('Move_Table'[Group])="Static",
    CALCULATE(DISTINCTCOUNT('Table'[Customer]),
        FILTER(ALL('Table'),'Table'[Month]=MAX('Table'[Month])&amp;amp;&amp;amp;[Result1]=0)),
    MAX('Move_Table'[Group])="Move 2 times",
    CALCULATE(DISTINCTCOUNT('Table'[Customer]),
        FILTER(ALL('Table'),'Table'[Month]=MAX('Table'[Month])&amp;amp;&amp;amp;[Result1]=2)),  
        MAX('Move_Table'[Group])="Move 3 times",
    CALCULATE(DISTINCTCOUNT('Table'[Customer]),
        FILTER(ALL('Table'),'Table'[Month]=MAX('Table'[Month])&amp;amp;&amp;amp;[Result1]=3)),
    MAX('Move_Table'[Group])="Move 4 times",
    CALCULATE(DISTINCTCOUNT('Table'[Customer]),
        FILTER(ALL('Table'),'Table'[Month]=MAX('Table'[Month])&amp;amp;&amp;amp;[Result1]=4)),  
        MAX('Move_Table'[Group])="Move 5 times",
    CALCULATE(DISTINCTCOUNT('Table'[Customer]),
        FILTER(ALL('Table'),'Table'[Month]=MAX('Table'[Month])&amp;amp;&amp;amp;[Result1]=5)))&lt;/LI-CODE&gt;
&lt;P&gt;3. Result:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Liu Yang&lt;/P&gt;
&lt;P&gt;If this post &lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider &lt;EM&gt;Accept it as the solution&lt;/EM&gt; to help the other members find it more quickly&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2023 05:58:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DIstinct-count-based-on-multiple-conditons/m-p/3439283#M130574</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-09-20T05:58:56Z</dc:date>
    </item>
    <item>
      <title>Re: DIstinct count based on multiple conditons</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DIstinct-count-based-on-multiple-conditons/m-p/3440247#M130654</link>
      <description>&lt;P&gt;Thanks a lot.&lt;/P&gt;&lt;P&gt;For Result1 i used the below;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Distinct regions =&lt;/SPAN&gt; &lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;DISTINCTCOUNT&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Table'&lt;/SPAN&gt;&lt;SPAN&gt;[city]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;ALLEXCEPT&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Table'&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;'Table'&lt;/SPAN&gt;&lt;SPAN&gt;[customer]&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;'Table'&lt;/SPAN&gt;&lt;SPAN&gt;[Mth]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;which worked well..gave me the distinct number of cities the customers visited over the 8month period&lt;BR /&gt;&lt;BR /&gt;&lt;/DIV&gt;&lt;P&gt;2. a little modification to your second solution (result2) worked perfectly for me. However my table has 8 months. how do i modify the filter condition so that it considers all the months and not give me the results for just the maximum month. so that i can categorise (move 2 times, move 3 times, ..., move n times) for the distinct cities for all the customers over the 8 month period.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2023 15:35:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DIstinct-count-based-on-multiple-conditons/m-p/3440247#M130654</guid>
      <dc:creator>DeeA</dc:creator>
      <dc:date>2023-09-20T15:35:45Z</dc:date>
    </item>
  </channel>
</rss>

