<?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 DAX formula count single value in D365 multiselect field in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-count-single-value-in-D365-multiselect-field/m-p/3976559#M154183</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;In a Power Bi report, connected to Dynamics 365 environment by direct query, i need to count how many times a single value (1) of a multiselect field appears in the column.&lt;/P&gt;&lt;P&gt;Examining the input data, I found that the values have the following format:&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;&amp;nbsp;&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried with the following expression, but it counts every single row:&lt;/P&gt;&lt;P&gt;Single option = CALCULATE(COUNTROWS(campaign), NOT(ISBLANK(FIND("1", campaign[Multiselect Field]))))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also tried with this other expression, and count only rows that has the single value "1":&lt;/P&gt;&lt;P&gt;Single option = CALCULATE(COUNTROWS(campaign),CONTAINSSTRING("1", campaign[Destinatari Campagna]))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone help me?&lt;/P&gt;</description>
    <pubDate>Fri, 07 Jun 2024 09:04:46 GMT</pubDate>
    <dc:creator>Pwrbi_usr</dc:creator>
    <dc:date>2024-06-07T09:04:46Z</dc:date>
    <item>
      <title>DAX formula count single value in D365 multiselect field</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-count-single-value-in-D365-multiselect-field/m-p/3976559#M154183</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;In a Power Bi report, connected to Dynamics 365 environment by direct query, i need to count how many times a single value (1) of a multiselect field appears in the column.&lt;/P&gt;&lt;P&gt;Examining the input data, I found that the values have the following format:&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;&amp;nbsp;&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried with the following expression, but it counts every single row:&lt;/P&gt;&lt;P&gt;Single option = CALCULATE(COUNTROWS(campaign), NOT(ISBLANK(FIND("1", campaign[Multiselect Field]))))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also tried with this other expression, and count only rows that has the single value "1":&lt;/P&gt;&lt;P&gt;Single option = CALCULATE(COUNTROWS(campaign),CONTAINSSTRING("1", campaign[Destinatari Campagna]))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone help me?&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2024 09:04:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-count-single-value-in-D365-multiselect-field/m-p/3976559#M154183</guid>
      <dc:creator>Pwrbi_usr</dc:creator>
      <dc:date>2024-06-07T09:04:46Z</dc:date>
    </item>
    <item>
      <title>Re: DAX formula count single value in D365 multiselect field</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-count-single-value-in-D365-multiselect-field/m-p/3978579#M154259</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="755103" data-lia-user-login="Pwrbi_usr" class="lia-mention lia-mention-user"&gt;Pwrbi_usr&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Based on your description, I've created the following sample data:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Using the Find function is the right choice. First, I created a dummy table in my measure as follows:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Second, I use the countax function to count the column columns. The final measure expression is as follows:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Has1value = 
VAR _table = SUMMARIZE('Table','Table'[Column1],"a",FIND(1,'Table'[Column1],1,0))
RETURN COUNTAX(FILTER(_table,[a] &amp;lt;&amp;gt;0),'Table'[Column1])&lt;/LI-CODE&gt;
&lt;P&gt;Here are the results:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;I've uploaded the PBIX file I used this time below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcommunity.powerbi.com%2Ft5%2FCommunity-Blog%2FHow-to-Get-Your-Question-Answered-Quickly%2Fba-p%2F38490&amp;amp;data=05%7C02%7Cv-jianpengli%40microsoft.com%7Cd9552f18a0c94a7564f308dc188bf35e%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C638412236574903368%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;amp;sdata=3jxUE%2BTNC8dS4DIhPphEB3NA%2BK94pwURGHu%2BXC4eezw%3D&amp;amp;reserved=0" target="_blank"&gt;How to Get Your Question Answered Quickly&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;
&lt;P&gt;Jianpeng Li&lt;/P&gt;
&lt;P&gt;If this post&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2024 03:48:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-count-single-value-in-D365-multiselect-field/m-p/3978579#M154259</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-06-07T03:48:28Z</dc:date>
    </item>
    <item>
      <title>Re: DAX formula count single value in D365 multiselect field</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-count-single-value-in-D365-multiselect-field/m-p/3979197#M154286</link>
      <description>&lt;P&gt;I tried your&amp;nbsp; DAX expression, but if there is the same value in multiple rows, only one is considered:&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;&amp;nbsp;&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;&lt;P&gt;&amp;nbsp;&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;While in input I've 10 rows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2024 09:03:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-count-single-value-in-D365-multiselect-field/m-p/3979197#M154286</guid>
      <dc:creator>Pwrbi_usr</dc:creator>
      <dc:date>2024-06-07T09:03:19Z</dc:date>
    </item>
    <item>
      <title>Re: DAX formula count single value in D365 multiselect field</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-count-single-value-in-D365-multiselect-field/m-p/3990269#M154747</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="755103" data-lia-user-login="Pwrbi_usr" class="lia-mention lia-mention-user"&gt;Pwrbi_usr&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you very much for your reply. Since the summary will ignore the rows that have the same value. I modified this DAX expression:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;This way rows with the same value will not be ignored, and the final DAX expression will look like this:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Has1value = 
VAR _table = ADDCOLUMNS(CALCULATETABLE('Table'),"a",FIND(1,'Table'[Column1],1,0))
RETURN COUNTAX(FILTER(_table,[a] &amp;lt;&amp;gt;0),'Table'[Column1])&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;I've uploaded the PBIX file I used this time below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcommunity.powerbi.com%2Ft5%2FCommunity-Blog%2FHow-to-Get-Your-Question-Answered-Quickly%2Fba-p%2F38490&amp;amp;data=05%7C02%7Cv-jianpengli%40microsoft.com%7Cd9552f18a0c94a7564f308dc188bf35e%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C638412236574903368%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;amp;sdata=3jxUE%2BTNC8dS4DIhPphEB3NA%2BK94pwURGHu%2BXC4eezw%3D&amp;amp;reserved=0" target="_blank"&gt;How to Get Your Question Answered Quickly&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;
&lt;P&gt;Jianpeng Li&lt;/P&gt;
&lt;P&gt;If this post&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2024 06:04:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-count-single-value-in-D365-multiselect-field/m-p/3990269#M154747</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-06-13T06:04:43Z</dc:date>
    </item>
  </channel>
</rss>

