<?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 Count from multiple columns in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-from-multiple-columns/m-p/3556847#M136956</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Hi All,&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV&gt;&lt;DIV class=""&gt;I need help to create a measure which would provide the count of spareparts used&lt;BR /&gt;I have two sheets Sparepart dataset and unique sparepart list&lt;BR /&gt;My data set&lt;BR /&gt;Case id,&lt;BR /&gt;Status,&lt;BR /&gt;Sparepart1&lt;BR /&gt;Sparepart2&lt;BR /&gt;Sparepart3&lt;BR /&gt;Sparepart4&lt;BR /&gt;Sparepart5&lt;BR /&gt;Sparepart6&lt;BR /&gt;Sparepart7&lt;BR /&gt;Sparepart8&lt;BR /&gt;Depending on the repair case multiple spareparts can be used&lt;BR /&gt;So if only 1 spartpart was used entry will be only in sparepart1 and if 2 spareparts were used entry will be in Sparepart1 &amp;amp; Sparepart2&lt;BR /&gt;I have tried to create a measure&lt;BR /&gt;Spares:=VAR P1=Calculate(Countrows(dataset sheet),Sparepart1&amp;lt;&amp;gt;Blank())&lt;BR /&gt;P2=Calculate(Countrows(dataset sheet),Sparepart2&amp;lt;&amp;gt;Blank())&lt;BR /&gt;P3=Calculate(Countrows(dataset sheet),Sparepart3&amp;lt;&amp;gt;Blank())&lt;BR /&gt;P4=Calculate(Countrows(dataset sheet),Sparepart4&amp;lt;&amp;gt;Blank())&lt;BR /&gt;P5=Calculate(Countrows(dataset sheet),Sparepart5&amp;lt;&amp;gt;Blank())&lt;BR /&gt;P6=Calculate(Countrows(dataset sheet),Sparepart6&amp;lt;&amp;gt;Blank())&lt;BR /&gt;P7=Calculate(Countrows(dataset sheet),Sparepart7&amp;lt;&amp;gt;Blank())&lt;BR /&gt;P8=Calculate(Countrows(dataset sheet),Sparepart8&amp;lt;&amp;gt;Blank())&lt;BR /&gt;RETURN&lt;BR /&gt;P1+P2+P3+P4+P5+P6+P7+P8&lt;BR /&gt;&lt;BR /&gt;This is is duplicating the counts&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Tue, 28 Nov 2023 15:53:28 GMT</pubDate>
    <dc:creator>Avicric</dc:creator>
    <dc:date>2023-11-28T15:53:28Z</dc:date>
    <item>
      <title>Count from multiple columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-from-multiple-columns/m-p/3556847#M136956</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Hi All,&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV&gt;&lt;DIV class=""&gt;I need help to create a measure which would provide the count of spareparts used&lt;BR /&gt;I have two sheets Sparepart dataset and unique sparepart list&lt;BR /&gt;My data set&lt;BR /&gt;Case id,&lt;BR /&gt;Status,&lt;BR /&gt;Sparepart1&lt;BR /&gt;Sparepart2&lt;BR /&gt;Sparepart3&lt;BR /&gt;Sparepart4&lt;BR /&gt;Sparepart5&lt;BR /&gt;Sparepart6&lt;BR /&gt;Sparepart7&lt;BR /&gt;Sparepart8&lt;BR /&gt;Depending on the repair case multiple spareparts can be used&lt;BR /&gt;So if only 1 spartpart was used entry will be only in sparepart1 and if 2 spareparts were used entry will be in Sparepart1 &amp;amp; Sparepart2&lt;BR /&gt;I have tried to create a measure&lt;BR /&gt;Spares:=VAR P1=Calculate(Countrows(dataset sheet),Sparepart1&amp;lt;&amp;gt;Blank())&lt;BR /&gt;P2=Calculate(Countrows(dataset sheet),Sparepart2&amp;lt;&amp;gt;Blank())&lt;BR /&gt;P3=Calculate(Countrows(dataset sheet),Sparepart3&amp;lt;&amp;gt;Blank())&lt;BR /&gt;P4=Calculate(Countrows(dataset sheet),Sparepart4&amp;lt;&amp;gt;Blank())&lt;BR /&gt;P5=Calculate(Countrows(dataset sheet),Sparepart5&amp;lt;&amp;gt;Blank())&lt;BR /&gt;P6=Calculate(Countrows(dataset sheet),Sparepart6&amp;lt;&amp;gt;Blank())&lt;BR /&gt;P7=Calculate(Countrows(dataset sheet),Sparepart7&amp;lt;&amp;gt;Blank())&lt;BR /&gt;P8=Calculate(Countrows(dataset sheet),Sparepart8&amp;lt;&amp;gt;Blank())&lt;BR /&gt;RETURN&lt;BR /&gt;P1+P2+P3+P4+P5+P6+P7+P8&lt;BR /&gt;&lt;BR /&gt;This is is duplicating the counts&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 28 Nov 2023 15:53:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-from-multiple-columns/m-p/3556847#M136956</guid>
      <dc:creator>Avicric</dc:creator>
      <dc:date>2023-11-28T15:53:28Z</dc:date>
    </item>
    <item>
      <title>Re: Count from multiple columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-from-multiple-columns/m-p/3557028#M136971</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="635682" data-lia-user-login="Avicric" class="lia-mention lia-mention-user"&gt;Avicric&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;If I understood correctly your dataset is something like this right?&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you really need to have the data in this format to do that calculation?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You could, in PowerQuery, unpivot the SpareParts columns, and with this you will have one row per CaseID and SparePart and it will be a simple COUNTROWS() of the table:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the PowerBI I used for this example :&amp;nbsp;&lt;A href="https://we.tl/t-MmD4LGlIau" target="_blank"&gt;https://we.tl/t-MmD4LGlIau&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this answer solves your problem!&lt;BR /&gt;If you need any additional help please &lt;SPAN&gt;@&lt;/SPAN&gt; me in your reply.&lt;BR /&gt;If my reply provided you with a solution, please consider marking it as a solution &lt;span class="lia-unicode-emoji" title=":heavy_check_mark:"&gt;✔️&lt;/span&gt; or giving it a kudo &lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;BR /&gt;Thanks!&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://www.linkedin.com/in/jpessoa08" target="_blank"&gt;You can also check out my LinkedIn!&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;Jorge Pessoa&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Nov 2023 17:46:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-from-multiple-columns/m-p/3557028#M136971</guid>
      <dc:creator>jpessoa8</dc:creator>
      <dc:date>2023-11-28T17:46:36Z</dc:date>
    </item>
    <item>
      <title>Re: Count from multiple columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-from-multiple-columns/m-p/3557032#M136972</link>
      <description>&lt;P&gt;that doesn't appear to be valid syntax for tables &amp;amp; columns. I am using it like below and that seems to work fine..&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;spares = 
 VAR P1=Calculate(Countrows('dataset sheet'),'dataset sheet'[Sparepart1]&amp;lt;&amp;gt;Blank())

etc.&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 28 Nov 2023 17:47:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-from-multiple-columns/m-p/3557032#M136972</guid>
      <dc:creator>sjoerdvn</dc:creator>
      <dc:date>2023-11-28T17:47:55Z</dc:date>
    </item>
    <item>
      <title>Re: Count from multiple columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-from-multiple-columns/m-p/3557881#M137012</link>
      <description>&lt;P&gt;Hi jpessoa8&lt;/P&gt;&lt;P&gt;No thats not how my dataset looks,&lt;/P&gt;&lt;P&gt;Image1 is the dataset&amp;nbsp;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Image2 is the unique part list(this is just an example my actual list is a total of 800 unique spareparts)&lt;/P&gt;&lt;P&gt;I want to show count of sparepart month wise/region/etc&lt;/P&gt;&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="226664" data-lia-user-login="sjoerdvn" class="lia-mention lia-mention-user"&gt;sjoerdvn&lt;/a&gt;&amp;nbsp;when i use the created measure the values are duplicating for example in the image for my dataset hammer was used 3 but for some reason the count for hammer is incorrect&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Hope this helps you to help me&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Nov 2023 04:35:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-from-multiple-columns/m-p/3557881#M137012</guid>
      <dc:creator>Avicric</dc:creator>
      <dc:date>2023-11-29T04:35:35Z</dc:date>
    </item>
    <item>
      <title>Re: Count from multiple columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-from-multiple-columns/m-p/3558205#M137053</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="635682" data-lia-user-login="Avicric" class="lia-mention lia-mention-user"&gt;Avicric&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I was missing in my approach was specifying the type of SparePart.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With that information, the only difference is to relate unpivoted table I've suggested with the SpareParts list table:&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;With this you can see the information either by CaseID or SparePart item:&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;Here is the revised PowerBI file :&amp;nbsp;&lt;A href="https://we.tl/t-CSZCMgmdYh" target="_blank"&gt;https://we.tl/t-CSZCMgmdYh&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For additional help, please &lt;SPAN&gt;@&lt;/SPAN&gt; me in your reply!&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://www.linkedin.com/in/jpessoa08" target="_blank"&gt;You can also check out my LinkedIn!&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;Jorge Pessoa&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Nov 2023 08:19:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-from-multiple-columns/m-p/3558205#M137053</guid>
      <dc:creator>jpessoa8</dc:creator>
      <dc:date>2023-11-29T08:19:06Z</dc:date>
    </item>
    <item>
      <title>Re: Count from multiple columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-from-multiple-columns/m-p/3559256#M137125</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="525058" data-lia-user-login="jpessoa8" class="lia-mention lia-mention-user"&gt;jpessoa8&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The measure is not duplicating the count of spareparts used. It is however duplicating the count of the number of cases in which a sparepart is used.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Any suggestions to fix this...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Also i am not using power bi&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I am working on power pivot to achieve this..&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Nov 2023 15:30:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-from-multiple-columns/m-p/3559256#M137125</guid>
      <dc:creator>Avicric</dc:creator>
      <dc:date>2023-11-29T15:30:31Z</dc:date>
    </item>
    <item>
      <title>Re: Count from multiple columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-from-multiple-columns/m-p/3559320#M137132</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="635682" data-lia-user-login="Avicric" class="lia-mention lia-mention-user"&gt;Avicric&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm sorry but I'm failing to understand the outcome you need.&lt;BR /&gt;&lt;BR /&gt;Base on thedata on the 2 prints you've sent, can you do another one with the expected resulted?&lt;/P&gt;</description>
      <pubDate>Wed, 29 Nov 2023 16:11:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-from-multiple-columns/m-p/3559320#M137132</guid>
      <dc:creator>jpessoa8</dc:creator>
      <dc:date>2023-11-29T16:11:09Z</dc:date>
    </item>
    <item>
      <title>Re: Count from multiple columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-from-multiple-columns/m-p/3559475#M137143</link>
      <description>&lt;P&gt;Appologies for the confusion...&lt;/P&gt;&lt;P&gt;Want i want to achieve with the measure for sparepart count is creating a pivot table with unique spartpart in rows and months in columns so that I can use slicers for Brand/Product/Region etc to get more insights&lt;/P&gt;&lt;P&gt;When i use the my measure or the one suggested I am getting incorrect counts...&lt;/P&gt;</description>
      <pubDate>Wed, 29 Nov 2023 17:34:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-from-multiple-columns/m-p/3559475#M137143</guid>
      <dc:creator>Avicric</dc:creator>
      <dc:date>2023-11-29T17:34:08Z</dc:date>
    </item>
    <item>
      <title>Re: Count from multiple columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-from-multiple-columns/m-p/3559500#M137146</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="635682" data-lia-user-login="Avicric" class="lia-mention lia-mention-user"&gt;Avicric&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The print you've provided doesn't include&amp;nbsp;any date or month information...&lt;/P&gt;&lt;P&gt;How is that included in your model?&lt;/P&gt;</description>
      <pubDate>Wed, 29 Nov 2023 17:52:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-from-multiple-columns/m-p/3559500#M137146</guid>
      <dc:creator>jpessoa8</dc:creator>
      <dc:date>2023-11-29T17:52:59Z</dc:date>
    </item>
    <item>
      <title>Re: Count from multiple columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-from-multiple-columns/m-p/3561411#M137276</link>
      <description>&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt; &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="525058" data-lia-user-login="jpessoa8" class="lia-mention lia-mention-user"&gt;jpessoa8&lt;/a&gt;&amp;nbsp;heres and updated picture&lt;/P&gt;&lt;P&gt;For months i have added an column using format("mmm-yy") for created and closed month&lt;/P&gt;&lt;P&gt;Dates are in dd-mm-yy format&lt;/P&gt;</description>
      <pubDate>Thu, 30 Nov 2023 16:12:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-from-multiple-columns/m-p/3561411#M137276</guid>
      <dc:creator>Avicric</dc:creator>
      <dc:date>2023-11-30T16:12:56Z</dc:date>
    </item>
    <item>
      <title>Re: Count from multiple columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-from-multiple-columns/m-p/3561694#M137284</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="635682" data-lia-user-login="Avicric" class="lia-mention lia-mention-user"&gt;Avicric&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Adding the date columns to dataset following the Unpivot approach, the next step is to had a Date table and relate it to the existing tables via DateStart&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With that, you can drap a month column in a matrix with the spareparts and add the measure for counting:&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;Here is the PowerBI version with this implementation:&amp;nbsp;&lt;A href="https://we.tl/t-dpKfsMa7sx" target="_blank"&gt;https://we.tl/t-dpKfsMa7sx&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this answer solves your problem!&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;If my reply provided you with a solution, please consider marking it as a solution &lt;span class="lia-unicode-emoji" title=":heavy_check_mark:"&gt;✔️&lt;/span&gt; or giving it a kudo &lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;BR /&gt;Thanks!&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://www.linkedin.com/in/jpessoa08" target="_blank"&gt;You can also check out my LinkedIn!&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;Jorge Pessoa&lt;/P&gt;</description>
      <pubDate>Thu, 30 Nov 2023 18:35:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-from-multiple-columns/m-p/3561694#M137284</guid>
      <dc:creator>jpessoa8</dc:creator>
      <dc:date>2023-11-30T18:35:08Z</dc:date>
    </item>
  </channel>
</rss>

