<?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 Text in Columns in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-Text-in-Columns/m-p/2472517#M67385</link>
    <description>&lt;P&gt;HI&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;BR /&gt;The only way I could think of&amp;nbsp;to unpivot the table using DAX is by hard coding the 40 columns. However, Power Query does it the same way, the only difference is that it generates the code automatically for you but in DAX you need to write it yourself.&lt;BR /&gt;I understand the disaster you went through when attempting to unpivot using Power Query therefore, please keep a backup copy before trying this with DAX. In general DAX is faster than Power Query and this code contains only two functions, UNION and SELECTCOLUMNS which are the fastest functions in DAX. Yet this might consume a significant amount of execution&amp;nbsp;time for your big data to be processed but it is unlikely to crash.&lt;BR /&gt;The code is a repetition&amp;nbsp;of a SELECTCOLUMNS statement (highlighted&amp;nbsp;in green) that you need to copy and paste 40 times. Only the ones highlighted in red are the ones that you need to edit. Once you do that it would be easy to sum and count based on any filters you wish. (Please provide more details about the desired results and perhaps&amp;nbsp;provide sample data to work with. Have a great day.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Ticketing Upivoted = 
UNION (
    SELECTCOLUMNS ( 
        Ticketing, 
        "Result", Ticketing[Results #1], "Result 2", Ticketing[Results #2], "Result 3", Ticketing[Results #3], "Result 4", Ticketing[Results #4], "Result 5", Ticketing[Results #5], "Result#", Ticketing[Results #], "Attribute", "ABF", "Value", Ticketing[ABF]
    ),
    SELECTCOLUMNS ( 
        Ticketing, 
        "Result", Ticketing[Results #1], "Result 2", Ticketing[Results #2], "Result 3", Ticketing[Results #3], "Result 4", Ticketing[Results #4], "Result 5", Ticketing[Results #5], "Result#", Ticketing[Results #], "Attribute", "GPON", "Value", Ticketing[GPON]
    ),
    SELECTCOLUMNS ( 
        Ticketing, 
        "Result", Ticketing[Results #1], "Result 2", Ticketing[Results #2], "Result 3", Ticketing[Results #3], "Result 4", Ticketing[Results #4], "Result 5", Ticketing[Results #5], "Result#", Ticketing[Results #], "Attribute", "Not availabl", "Value", Ticketing[Not available]
    ),
    SELECTCOLUMNS ( 
        Ticketing, 
        "Result", Ticketing[Results #1], "Result 2", Ticketing[Results #2], "Result 3", Ticketing[Results #3], "Result 4", Ticketing[Results #4], "Result 5", Ticketing[Results #5], "Result#", Ticketing[Results #], "Attribute", "Light Green", "Value", Ticketing[Light Green]
    )
)&lt;/LI-CODE&gt;</description>
    <pubDate>Sat, 23 Apr 2022 05:55:51 GMT</pubDate>
    <dc:creator>tamerj1</dc:creator>
    <dc:date>2022-04-23T05:55:51Z</dc:date>
    <item>
      <title>Count Text in Columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-Text-in-Columns/m-p/2467106#M67044</link>
      <description>&lt;P&gt;hello..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have 40 columns.&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Results #1&lt;/TD&gt;&lt;TD&gt;Results #2&lt;/TD&gt;&lt;TD&gt;Results #3&lt;/TD&gt;&lt;TD&gt;Results #&lt;/TD&gt;&lt;TD&gt;Results #4&lt;/TD&gt;&lt;TD&gt;Results #5&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;ABF&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;GPON&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Not available&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Light Green&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;ABF&lt;/TD&gt;&lt;TD&gt;NOT available&lt;/TD&gt;&lt;TD&gt;ABF&lt;/TD&gt;&lt;TD&gt;ABF&lt;/TD&gt;&lt;TD&gt;ABF&lt;/TD&gt;&lt;TD&gt;Light Green&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;4&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;I need a forumla to give the number of times it sees the text "ABF" and then one for another column "GPON" so on and so fourth.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am going to take these values, then total these in my visual.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am having a hard time getting the text counted in the columns per row.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The columns in bold are the totals for each choice I am trying to create&amp;nbsp;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2022 16:39:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-Text-in-Columns/m-p/2467106#M67044</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-04-20T16:39:43Z</dc:date>
    </item>
    <item>
      <title>Re: Count Text in Columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-Text-in-Columns/m-p/2467251#M67050</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'd suggest to unpivot your table in Power Query. For this, go into Power Query, mark all the columns and click on&amp;nbsp;&lt;STRONG&gt;Unpivot Columns:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You should end up with a much longer table than this, but with the same structure:&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;After you can create a measure like CALCULATE ( COUNT ( 'table'[Value] ), 'table'[Value] = "ABF" ) in DAX.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would this work out for you? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/Tom&lt;BR /&gt;&lt;A href="https://www.tackytech.blog/" target="_blank" rel="noopener"&gt;https://www.tackytech.blog/&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://www.instagram.com/tackytechtom/" target="_blank" rel="noopener"&gt;https://www.instagram.com/tackytechtom/&lt;/A&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;</description>
      <pubDate>Wed, 20 Apr 2022 17:47:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-Text-in-Columns/m-p/2467251#M67050</guid>
      <dc:creator>tackytechtom</dc:creator>
      <dc:date>2022-04-20T17:47:42Z</dc:date>
    </item>
    <item>
      <title>Re: Count Text in Columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-Text-in-Columns/m-p/2467495#M67074</link>
      <description>&lt;P&gt;I get an error when I unpivot the columns. On attribute and value&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2022 20:49:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-Text-in-Columns/m-p/2467495#M67074</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-04-20T20:49:20Z</dc:date>
    </item>
    <item>
      <title>Re: Count Text in Columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-Text-in-Columns/m-p/2472517#M67385</link>
      <description>&lt;P&gt;HI&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;BR /&gt;The only way I could think of&amp;nbsp;to unpivot the table using DAX is by hard coding the 40 columns. However, Power Query does it the same way, the only difference is that it generates the code automatically for you but in DAX you need to write it yourself.&lt;BR /&gt;I understand the disaster you went through when attempting to unpivot using Power Query therefore, please keep a backup copy before trying this with DAX. In general DAX is faster than Power Query and this code contains only two functions, UNION and SELECTCOLUMNS which are the fastest functions in DAX. Yet this might consume a significant amount of execution&amp;nbsp;time for your big data to be processed but it is unlikely to crash.&lt;BR /&gt;The code is a repetition&amp;nbsp;of a SELECTCOLUMNS statement (highlighted&amp;nbsp;in green) that you need to copy and paste 40 times. Only the ones highlighted in red are the ones that you need to edit. Once you do that it would be easy to sum and count based on any filters you wish. (Please provide more details about the desired results and perhaps&amp;nbsp;provide sample data to work with. Have a great day.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Ticketing Upivoted = 
UNION (
    SELECTCOLUMNS ( 
        Ticketing, 
        "Result", Ticketing[Results #1], "Result 2", Ticketing[Results #2], "Result 3", Ticketing[Results #3], "Result 4", Ticketing[Results #4], "Result 5", Ticketing[Results #5], "Result#", Ticketing[Results #], "Attribute", "ABF", "Value", Ticketing[ABF]
    ),
    SELECTCOLUMNS ( 
        Ticketing, 
        "Result", Ticketing[Results #1], "Result 2", Ticketing[Results #2], "Result 3", Ticketing[Results #3], "Result 4", Ticketing[Results #4], "Result 5", Ticketing[Results #5], "Result#", Ticketing[Results #], "Attribute", "GPON", "Value", Ticketing[GPON]
    ),
    SELECTCOLUMNS ( 
        Ticketing, 
        "Result", Ticketing[Results #1], "Result 2", Ticketing[Results #2], "Result 3", Ticketing[Results #3], "Result 4", Ticketing[Results #4], "Result 5", Ticketing[Results #5], "Result#", Ticketing[Results #], "Attribute", "Not availabl", "Value", Ticketing[Not available]
    ),
    SELECTCOLUMNS ( 
        Ticketing, 
        "Result", Ticketing[Results #1], "Result 2", Ticketing[Results #2], "Result 3", Ticketing[Results #3], "Result 4", Ticketing[Results #4], "Result 5", Ticketing[Results #5], "Result#", Ticketing[Results #], "Attribute", "Light Green", "Value", Ticketing[Light Green]
    )
)&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 23 Apr 2022 05:55:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-Text-in-Columns/m-p/2472517#M67385</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-04-23T05:55:51Z</dc:date>
    </item>
    <item>
      <title>Re: Count Text in Columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-Text-in-Columns/m-p/2477994#M67731</link>
      <description>&lt;P&gt;You may not remember me... but I have posted about this before. THANK YOU!!!!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2022 14:01:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-Text-in-Columns/m-p/2477994#M67731</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-04-26T14:01:52Z</dc:date>
    </item>
    <item>
      <title>Re: Count Text in Columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-Text-in-Columns/m-p/2477995#M67732</link>
      <description>&lt;P&gt;I ended up being able to unpiviot the columns because of you&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2022 14:02:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-Text-in-Columns/m-p/2477995#M67732</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-04-26T14:02:11Z</dc:date>
    </item>
    <item>
      <title>Re: Count Text in Columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-Text-in-Columns/m-p/2478044#M67738</link>
      <description>&lt;P&gt;But that after I caused your file to crash. Sorry for that again.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2022 14:15:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-Text-in-Columns/m-p/2478044#M67738</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-04-26T14:15:54Z</dc:date>
    </item>
  </channel>
</rss>

