{"id":4000,"date":"2022-02-11T09:31:38","date_gmt":"2022-02-11T17:31:38","guid":{"rendered":"https:\/\/SUMMALAI.COM\/?p=4000"},"modified":"2022-02-11T09:31:39","modified_gmt":"2022-02-11T17:31:39","slug":"countrows-vs-count-vs-counta","status":"publish","type":"post","link":"https:\/\/SUMMALAI.COM\/?p=4000","title":{"rendered":"COUNTROWS vs COUNT vs COUNTA"},"content":{"rendered":"\n<p>As a data modeler, sometimes you might need to write a DAX expression that counts table rows. The table could be a model table or an expression that returns a table.<\/p>\n\n\n\n<p>Your requirement can be achieved in two ways. You can use the&nbsp;<a href=\"https:\/\/docs.microsoft.com\/en-us\/dax\/count-function-dax\">COUNT<\/a>&nbsp;function to count column values, or you can use the&nbsp;<a href=\"https:\/\/docs.microsoft.com\/en-us\/dax\/countrows-function-dax\">COUNTROWS<\/a>&nbsp;function to count table rows. Both functions will achieve the same result, providing that the counted column contains no BLANKs.<\/p>\n\n\n\n<p>The&nbsp;<strong>COUNT <\/strong>function counts the number of records that contain a number in a single-column table.<\/p>\n\n\n\n<p>The&nbsp;<strong>COUNTA<\/strong>&nbsp;function counts the number of records that aren&#8217;t&nbsp;<em>blank<\/em>&nbsp;in a single-column table. This function includes&nbsp;<a href=\"https:\/\/docs.microsoft.com\/en-us\/powerapps\/maker\/canvas-apps\/functions\/function-isblank-isempty\">empty<\/a>&nbsp;text (&#8220;&#8221;) in the count.<\/p>\n\n\n\n<p>The following measure definition presents an example. It calculates the number of&nbsp;<strong>OrderDate<\/strong>&nbsp;column values.DAXCopy<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Sales Orders =\nCOUNT(Sales&#91;OrderDate])\n<\/code><\/pre>\n\n\n\n<p>Providing that the granularity of the&nbsp;<strong>Sales<\/strong>&nbsp;table is one row per sales order, and the&nbsp;<strong>OrderDate<\/strong>&nbsp;column does not contain BLANKs, then the measure will return a correct result.<\/p>\n\n\n\n<p>However, the following measure definition is a better solution.DAXCopy<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Sales Orders =\nCOUNTROWS(Sales)\n<\/code><\/pre>\n\n\n\n<p>There are three reasons why the second measure definition is better:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>It&#8217;s more efficient, and so it will perform better.<\/li><li>It doesn&#8217;t consider BLANKs contained in any column of the table.<\/li><li>The intention of formula is clearer, to the point of being self-describing.<\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>As a data modeler, sometimes you might need to write a DAX expression that counts table rows. The table could be a model table or an expression that returns a table. Your requirement can be achieved in two ways. You can use the&nbsp;COUNT&nbsp;function to count column values, or you can use the&nbsp;COUNTROWS&nbsp;function to count table <a class=\"read-more\" href=\"https:\/\/SUMMALAI.COM\/?p=4000\">Read More<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[10,621,625],"tags":[1109,1107,1108],"class_list":["post-4000","post","type-post","status-publish","format-standard","hentry","category-microsoft","category-power-bi","category-sql","tag-count-vs-counta","tag-countrows-vs-count","tag-countrows-vs-count-vs-counta"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.10 - aioseo.com -->\n\t<meta name=\"description\" content=\"As a data modeler, sometimes you might need to write a DAX expression that counts table rows. The table could be a model table or an expression that returns a table. Your requirement can be achieved in two ways. You can use the COUNT function to count column values, or you can use the COUNTROWS function to count table\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Summa Lai\"\/>\n\t<meta name=\"keywords\" content=\"count vs counta,countrows vs count,countrows vs count vs counta,microsoft family,power bi,sql\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/SUMMALAI.COM\/?p=4000\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.10\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/SUMMALAI.COM\\\/?p=4000#article\",\"name\":\"COUNTROWS vs COUNT vs COUNTA | Summa Lai\",\"headline\":\"COUNTROWS vs COUNT vs COUNTA\",\"author\":{\"@id\":\"https:\\\/\\\/SUMMALAI.COM\\\/?author=2#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/SUMMALAI.COM\\\/#person\"},\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/SUMMALAI.COM\\\/?p=4000#articleImage\",\"url\":\"https:\\\/\\\/SUMMALAI.COM\\\/wp-content\\\/uploads\\\/2020\\\/05\\\/Summa_Logo-150x150.png\",\"width\":96,\"height\":96,\"caption\":\"Summa Lai\"},\"datePublished\":\"2022-02-11T09:31:38-08:00\",\"dateModified\":\"2022-02-11T09:31:39-08:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/SUMMALAI.COM\\\/?p=4000#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/SUMMALAI.COM\\\/?p=4000#webpage\"},\"articleSection\":\"Microsoft Family, Power BI, SQL, COUNT vs COUNTA, COUNTROWS vs COUNT, COUNTROWS vs COUNT vs COUNTA\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/SUMMALAI.COM\\\/?p=4000#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/SUMMALAI.COM#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/SUMMALAI.COM\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/SUMMALAI.COM\\\/?cat=10#listItem\",\"name\":\"Microsoft Family\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/SUMMALAI.COM\\\/?cat=10#listItem\",\"position\":2,\"name\":\"Microsoft Family\",\"item\":\"https:\\\/\\\/SUMMALAI.COM\\\/?cat=10\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/SUMMALAI.COM\\\/?cat=621#listItem\",\"name\":\"Power BI\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/SUMMALAI.COM#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/SUMMALAI.COM\\\/?cat=621#listItem\",\"position\":3,\"name\":\"Power BI\",\"item\":\"https:\\\/\\\/SUMMALAI.COM\\\/?cat=621\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/SUMMALAI.COM\\\/?p=4000#listItem\",\"name\":\"COUNTROWS vs COUNT vs COUNTA\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/SUMMALAI.COM\\\/?cat=10#listItem\",\"name\":\"Microsoft Family\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/SUMMALAI.COM\\\/?p=4000#listItem\",\"position\":4,\"name\":\"COUNTROWS vs COUNT vs COUNTA\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/SUMMALAI.COM\\\/?cat=621#listItem\",\"name\":\"Power BI\"}}]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/SUMMALAI.COM\\\/#person\",\"name\":\"sladmin\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/SUMMALAI.COM\\\/?p=4000#personImage\",\"url\":\"https:\\\/\\\/SUMMALAI.COM\\\/wp-content\\\/uploads\\\/2020\\\/05\\\/Summa_Logo-150x150.png\",\"width\":96,\"height\":96,\"caption\":\"sladmin\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/SUMMALAI.COM\\\/?author=2#author\",\"url\":\"https:\\\/\\\/SUMMALAI.COM\\\/?author=2\",\"name\":\"Summa Lai\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/SUMMALAI.COM\\\/?p=4000#authorImage\",\"url\":\"https:\\\/\\\/SUMMALAI.COM\\\/wp-content\\\/uploads\\\/2020\\\/05\\\/Summa_Logo-150x150.png\",\"width\":96,\"height\":96,\"caption\":\"Summa Lai\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/SUMMALAI.COM\\\/?p=4000#webpage\",\"url\":\"https:\\\/\\\/SUMMALAI.COM\\\/?p=4000\",\"name\":\"COUNTROWS vs COUNT vs COUNTA | Summa Lai\",\"description\":\"As a data modeler, sometimes you might need to write a DAX expression that counts table rows. The table could be a model table or an expression that returns a table. Your requirement can be achieved in two ways. You can use the COUNT function to count column values, or you can use the COUNTROWS function to count table\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/SUMMALAI.COM\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/SUMMALAI.COM\\\/?p=4000#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/SUMMALAI.COM\\\/?author=2#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/SUMMALAI.COM\\\/?author=2#author\"},\"datePublished\":\"2022-02-11T09:31:38-08:00\",\"dateModified\":\"2022-02-11T09:31:39-08:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/SUMMALAI.COM\\\/#website\",\"url\":\"https:\\\/\\\/SUMMALAI.COM\\\/\",\"name\":\"Summa Lai\",\"description\":\"Never Stop Learning, Building a Little Wiki...\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/SUMMALAI.COM\\\/#person\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"COUNTROWS vs COUNT vs COUNTA | Summa Lai","description":"As a data modeler, sometimes you might need to write a DAX expression that counts table rows. The table could be a model table or an expression that returns a table. Your requirement can be achieved in two ways. You can use the COUNT function to count column values, or you can use the COUNTROWS function to count table","canonical_url":"https:\/\/SUMMALAI.COM\/?p=4000","robots":"max-image-preview:large","keywords":"count vs counta,countrows vs count,countrows vs count vs counta,microsoft family,power bi,sql","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/SUMMALAI.COM\/?p=4000#article","name":"COUNTROWS vs COUNT vs COUNTA | Summa Lai","headline":"COUNTROWS vs COUNT vs COUNTA","author":{"@id":"https:\/\/SUMMALAI.COM\/?author=2#author"},"publisher":{"@id":"https:\/\/SUMMALAI.COM\/#person"},"image":{"@type":"ImageObject","@id":"https:\/\/SUMMALAI.COM\/?p=4000#articleImage","url":"https:\/\/SUMMALAI.COM\/wp-content\/uploads\/2020\/05\/Summa_Logo-150x150.png","width":96,"height":96,"caption":"Summa Lai"},"datePublished":"2022-02-11T09:31:38-08:00","dateModified":"2022-02-11T09:31:39-08:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/SUMMALAI.COM\/?p=4000#webpage"},"isPartOf":{"@id":"https:\/\/SUMMALAI.COM\/?p=4000#webpage"},"articleSection":"Microsoft Family, Power BI, SQL, COUNT vs COUNTA, COUNTROWS vs COUNT, COUNTROWS vs COUNT vs COUNTA"},{"@type":"BreadcrumbList","@id":"https:\/\/SUMMALAI.COM\/?p=4000#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/SUMMALAI.COM#listItem","position":1,"name":"Home","item":"https:\/\/SUMMALAI.COM","nextItem":{"@type":"ListItem","@id":"https:\/\/SUMMALAI.COM\/?cat=10#listItem","name":"Microsoft Family"}},{"@type":"ListItem","@id":"https:\/\/SUMMALAI.COM\/?cat=10#listItem","position":2,"name":"Microsoft Family","item":"https:\/\/SUMMALAI.COM\/?cat=10","nextItem":{"@type":"ListItem","@id":"https:\/\/SUMMALAI.COM\/?cat=621#listItem","name":"Power BI"},"previousItem":{"@type":"ListItem","@id":"https:\/\/SUMMALAI.COM#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/SUMMALAI.COM\/?cat=621#listItem","position":3,"name":"Power BI","item":"https:\/\/SUMMALAI.COM\/?cat=621","nextItem":{"@type":"ListItem","@id":"https:\/\/SUMMALAI.COM\/?p=4000#listItem","name":"COUNTROWS vs COUNT vs COUNTA"},"previousItem":{"@type":"ListItem","@id":"https:\/\/SUMMALAI.COM\/?cat=10#listItem","name":"Microsoft Family"}},{"@type":"ListItem","@id":"https:\/\/SUMMALAI.COM\/?p=4000#listItem","position":4,"name":"COUNTROWS vs COUNT vs COUNTA","previousItem":{"@type":"ListItem","@id":"https:\/\/SUMMALAI.COM\/?cat=621#listItem","name":"Power BI"}}]},{"@type":"Person","@id":"https:\/\/SUMMALAI.COM\/#person","name":"sladmin","image":{"@type":"ImageObject","@id":"https:\/\/SUMMALAI.COM\/?p=4000#personImage","url":"https:\/\/SUMMALAI.COM\/wp-content\/uploads\/2020\/05\/Summa_Logo-150x150.png","width":96,"height":96,"caption":"sladmin"}},{"@type":"Person","@id":"https:\/\/SUMMALAI.COM\/?author=2#author","url":"https:\/\/SUMMALAI.COM\/?author=2","name":"Summa Lai","image":{"@type":"ImageObject","@id":"https:\/\/SUMMALAI.COM\/?p=4000#authorImage","url":"https:\/\/SUMMALAI.COM\/wp-content\/uploads\/2020\/05\/Summa_Logo-150x150.png","width":96,"height":96,"caption":"Summa Lai"}},{"@type":"WebPage","@id":"https:\/\/SUMMALAI.COM\/?p=4000#webpage","url":"https:\/\/SUMMALAI.COM\/?p=4000","name":"COUNTROWS vs COUNT vs COUNTA | Summa Lai","description":"As a data modeler, sometimes you might need to write a DAX expression that counts table rows. The table could be a model table or an expression that returns a table. Your requirement can be achieved in two ways. You can use the COUNT function to count column values, or you can use the COUNTROWS function to count table","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/SUMMALAI.COM\/#website"},"breadcrumb":{"@id":"https:\/\/SUMMALAI.COM\/?p=4000#breadcrumblist"},"author":{"@id":"https:\/\/SUMMALAI.COM\/?author=2#author"},"creator":{"@id":"https:\/\/SUMMALAI.COM\/?author=2#author"},"datePublished":"2022-02-11T09:31:38-08:00","dateModified":"2022-02-11T09:31:39-08:00"},{"@type":"WebSite","@id":"https:\/\/SUMMALAI.COM\/#website","url":"https:\/\/SUMMALAI.COM\/","name":"Summa Lai","description":"Never Stop Learning, Building a Little Wiki...","inLanguage":"en-US","publisher":{"@id":"https:\/\/SUMMALAI.COM\/#person"}}]}},"aioseo_meta_data":{"post_id":"4000","title":null,"description":null,"keywords":[],"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":[],"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":{"id":"#aioseo-article-65a0c4f2555fd","slug":"article","graphName":"Article","label":"Article","properties":{"type":"BlogPosting","name":"#post_title","headline":"#post_title","description":"#post_excerpt","image":"","keywords":"","author":{"name":"#author_name","url":"#author_url"},"dates":{"include":true,"datePublished":"","dateModified":""}}},"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":"{\"article\":{\"articleType\":\"BlogPosting\"},\"course\":{\"name\":\"\",\"description\":\"\",\"provider\":\"\"},\"faq\":{\"pages\":[]},\"product\":{\"reviews\":[]},\"recipe\":{\"ingredients\":[],\"instructions\":[],\"keywords\":[]},\"software\":{\"reviews\":[],\"operatingSystems\":[]},\"webPage\":{\"webPageType\":\"WebPage\"}}","pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2022-02-11 01:28:29","updated":"2024-01-12 04:49:54","seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/SUMMALAI.COM\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/SUMMALAI.COM\/?cat=10\" title=\"Microsoft Family\">Microsoft Family<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/SUMMALAI.COM\/?cat=621\" title=\"Power BI\">Power BI<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tCOUNTROWS vs COUNT vs COUNTA\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/SUMMALAI.COM"},{"label":"Microsoft Family","link":"https:\/\/SUMMALAI.COM\/?cat=10"},{"label":"Power BI","link":"https:\/\/SUMMALAI.COM\/?cat=621"},{"label":"COUNTROWS vs COUNT vs COUNTA","link":"https:\/\/SUMMALAI.COM\/?p=4000"}],"_links":{"self":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts\/4000","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4000"}],"version-history":[{"count":4,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts\/4000\/revisions"}],"predecessor-version":[{"id":4004,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts\/4000\/revisions\/4004"}],"wp:attachment":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4000"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4000"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4000"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}