{"id":1964,"date":"2021-05-31T10:39:50","date_gmt":"2021-05-31T10:39:50","guid":{"rendered":"https:\/\/bi.unija.com\/en\/?p=1964"},"modified":"2021-05-31T10:40:32","modified_gmt":"2021-05-31T10:40:32","slug":"count-table-rows-in-power-bi","status":"publish","type":"post","link":"https:\/\/bi.unija.com\/en\/count-table-rows-in-power-bi\/","title":{"rendered":"Count Table Rows in Power BI"},"content":{"rendered":"<p><em>For Power BI version 2.76.5678.782 (December 2019).<\/em><\/p>\n<p>When working with data in Power BI, we often create new custom tables using fields and measures from multiple tables. If we\u2019re not careful we can quickly create redundantly large tables. Unfortunately, Power BI doesn\u2019t have a way to show the size of such custom tables, but we can get that information with a little help of R visualization. Let\u2019s look at two ways to check the number of rows of our table visualization.<\/p>\n<h1>Method 1: With R Installation<\/h1>\n<p>If you have R installed on your Desktop, you only need to open up the table in RStudio and check the table size. Follow the steps bellow.<\/p>\n<p>Our sample table consists of 6 fields: some are fields from other tables and some are explicit measures.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"759\" height=\"521\" class=\"wp-image-1965\" src=\"https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2021\/05\/word-image-22.png\" srcset=\"https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2021\/05\/word-image-22.png 759w, https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2021\/05\/word-image-22-300x206.png 300w\" sizes=\"(max-width: 759px) 100vw, 759px\" \/><\/p>\n<p>We first change table visualisation to R visualisation: select the table and click <strong>R visualisation<\/strong>.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"760\" height=\"528\" class=\"wp-image-1966\" src=\"https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2021\/05\/word-image-23.png\" srcset=\"https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2021\/05\/word-image-23.png 760w, https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2021\/05\/word-image-23-300x208.png 300w\" sizes=\"(max-width: 760px) 100vw, 760px\" \/><\/p>\n<p>Table becomes blank like on the image bellow. We open up <strong>RStudio<\/strong> by selecting arrow on the right lower end of the pane.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1474\" height=\"821\" class=\"wp-image-1967\" src=\"https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2021\/05\/word-image-24.png\" srcset=\"https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2021\/05\/word-image-24.png 1474w, https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2021\/05\/word-image-24-300x167.png 300w, https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2021\/05\/word-image-24-1024x570.png 1024w, https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2021\/05\/word-image-24-768x428.png 768w\" sizes=\"(max-width: 1474px) 100vw, 1474px\" \/><\/p>\n<p>RStudio window opens up, containing the message bellow.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"559\" height=\"143\" class=\"wp-image-1968\" src=\"https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2021\/05\/word-image-25.png\" srcset=\"https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2021\/05\/word-image-25.png 559w, https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2021\/05\/word-image-25-300x77.png 300w\" sizes=\"(max-width: 559px) 100vw, 559px\" \/><\/p>\n<p>Our table is stored the variable called dataset. We add the following line:<\/p>\n<p><strong>n = nrow(dataset)<\/strong><\/p>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"378\" height=\"84\" class=\"wp-image-1969\" src=\"https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2021\/05\/word-image-26.png\" srcset=\"https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2021\/05\/word-image-26.png 378w, https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2021\/05\/word-image-26-300x67.png 300w\" sizes=\"(max-width: 378px) 100vw, 378px\" \/><\/strong><\/p>\n<p>We run the code and check the value for n.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"83\" height=\"35\" class=\"wp-image-1970\" src=\"https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2021\/05\/word-image-27.png\" \/><\/p>\n<p>That\u2019s it!<\/p>\n<h1>Method 2: Without R Installation<\/h1>\n<p>We can use R even if we don\u2019t have it installed. We won\u2019t get the result on our Desktop, but we\u2019ll see it once we publish the report to Service. The Service will process the R code and show us the result we need.<\/p>\n<p>Again change the table to R visual and paste the code bellow:<\/p>\n<p><strong>library(ggplot2)<\/strong><\/p>\n<p><strong>df = data.frame(x=1, y=1, label=n)<\/strong><\/p>\n<p><strong>ggplot(data=df, aes(x=x, y=y, label=label)) + geom_text(size=50) + theme_void()<\/strong><\/p>\n<p>Publish the report to Service. Once uploaded, visual will display the number of rows.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"597\" height=\"316\" class=\"wp-image-1971\" src=\"https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2021\/05\/word-image-28.png\" srcset=\"https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2021\/05\/word-image-28.png 597w, https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2021\/05\/word-image-28-300x159.png 300w\" sizes=\"(max-width: 597px) 100vw, 597px\" \/><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>For Power BI version 2.76.5678.782 (December 2019). When working with data in Power BI, we often create new custom tables using fields and measures from multiple tables. If we\u2019re not careful we can quickly create redundantly large tables. Unfortunately, Power<\/p>\n","protected":false},"author":5,"featured_media":1975,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1964","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Count Table Rows in Power BI - Bi Unija<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/bi.unija.com\/en\/count-table-rows-in-power-bi\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Count Table Rows in Power BI - Bi Unija\" \/>\n<meta property=\"og:description\" content=\"For Power BI version 2.76.5678.782 (December 2019). When working with data in Power BI, we often create new custom tables using fields and measures from multiple tables. If we\u2019re not careful we can quickly create redundantly large tables. Unfortunately, Power\" \/>\n<meta property=\"og:url\" content=\"https:\/\/bi.unija.com\/en\/count-table-rows-in-power-bi\/\" \/>\n<meta property=\"og:site_name\" content=\"Bi Unija\" \/>\n<meta property=\"article:published_time\" content=\"2021-05-31T10:39:50+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-05-31T10:40:32+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2021\/05\/49.png\" \/>\n\t<meta property=\"og:image:width\" content=\"720\" \/>\n\t<meta property=\"og:image:height\" content=\"480\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Branka Trifunovi\u0107\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Branka Trifunovi\u0107\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/bi.unija.com\/en\/count-table-rows-in-power-bi\/\",\"url\":\"https:\/\/bi.unija.com\/en\/count-table-rows-in-power-bi\/\",\"name\":\"Count Table Rows in Power BI - Bi Unija\",\"isPartOf\":{\"@id\":\"https:\/\/bi.unija.com\/en\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/bi.unija.com\/en\/count-table-rows-in-power-bi\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/bi.unija.com\/en\/count-table-rows-in-power-bi\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2021\/05\/49.png\",\"datePublished\":\"2021-05-31T10:39:50+00:00\",\"dateModified\":\"2021-05-31T10:40:32+00:00\",\"author\":{\"@id\":\"https:\/\/bi.unija.com\/en\/#\/schema\/person\/3bed36623727c7162e421c4366a54e10\"},\"breadcrumb\":{\"@id\":\"https:\/\/bi.unija.com\/en\/count-table-rows-in-power-bi\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/bi.unija.com\/en\/count-table-rows-in-power-bi\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/bi.unija.com\/en\/count-table-rows-in-power-bi\/#primaryimage\",\"url\":\"https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2021\/05\/49.png\",\"contentUrl\":\"https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2021\/05\/49.png\",\"width\":720,\"height\":480},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/bi.unija.com\/en\/count-table-rows-in-power-bi\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/bi.unija.com\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Count Table Rows in Power BI\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/bi.unija.com\/en\/#website\",\"url\":\"https:\/\/bi.unija.com\/en\/\",\"name\":\"Bi Unija\",\"description\":\"Just another Bi site\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/bi.unija.com\/en\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/bi.unija.com\/en\/#\/schema\/person\/3bed36623727c7162e421c4366a54e10\",\"name\":\"Branka Trifunovi\u0107\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/bi.unija.com\/en\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/ec99f651bcc98a163161515ec254b974?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/ec99f651bcc98a163161515ec254b974?s=96&d=mm&r=g\",\"caption\":\"Branka Trifunovi\u0107\"},\"url\":\"https:\/\/bi.unija.com\/en\/author\/branka\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Count Table Rows in Power BI - Bi Unija","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/bi.unija.com\/en\/count-table-rows-in-power-bi\/","og_locale":"en_US","og_type":"article","og_title":"Count Table Rows in Power BI - Bi Unija","og_description":"For Power BI version 2.76.5678.782 (December 2019). When working with data in Power BI, we often create new custom tables using fields and measures from multiple tables. If we\u2019re not careful we can quickly create redundantly large tables. Unfortunately, Power","og_url":"https:\/\/bi.unija.com\/en\/count-table-rows-in-power-bi\/","og_site_name":"Bi Unija","article_published_time":"2021-05-31T10:39:50+00:00","article_modified_time":"2021-05-31T10:40:32+00:00","og_image":[{"width":720,"height":480,"url":"https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2021\/05\/49.png","type":"image\/png"}],"author":"Branka Trifunovi\u0107","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Branka Trifunovi\u0107","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/bi.unija.com\/en\/count-table-rows-in-power-bi\/","url":"https:\/\/bi.unija.com\/en\/count-table-rows-in-power-bi\/","name":"Count Table Rows in Power BI - Bi Unija","isPartOf":{"@id":"https:\/\/bi.unija.com\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/bi.unija.com\/en\/count-table-rows-in-power-bi\/#primaryimage"},"image":{"@id":"https:\/\/bi.unija.com\/en\/count-table-rows-in-power-bi\/#primaryimage"},"thumbnailUrl":"https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2021\/05\/49.png","datePublished":"2021-05-31T10:39:50+00:00","dateModified":"2021-05-31T10:40:32+00:00","author":{"@id":"https:\/\/bi.unija.com\/en\/#\/schema\/person\/3bed36623727c7162e421c4366a54e10"},"breadcrumb":{"@id":"https:\/\/bi.unija.com\/en\/count-table-rows-in-power-bi\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/bi.unija.com\/en\/count-table-rows-in-power-bi\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/bi.unija.com\/en\/count-table-rows-in-power-bi\/#primaryimage","url":"https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2021\/05\/49.png","contentUrl":"https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2021\/05\/49.png","width":720,"height":480},{"@type":"BreadcrumbList","@id":"https:\/\/bi.unija.com\/en\/count-table-rows-in-power-bi\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/bi.unija.com\/en\/"},{"@type":"ListItem","position":2,"name":"Count Table Rows in Power BI"}]},{"@type":"WebSite","@id":"https:\/\/bi.unija.com\/en\/#website","url":"https:\/\/bi.unija.com\/en\/","name":"Bi Unija","description":"Just another Bi site","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/bi.unija.com\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/bi.unija.com\/en\/#\/schema\/person\/3bed36623727c7162e421c4366a54e10","name":"Branka Trifunovi\u0107","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/bi.unija.com\/en\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/ec99f651bcc98a163161515ec254b974?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ec99f651bcc98a163161515ec254b974?s=96&d=mm&r=g","caption":"Branka Trifunovi\u0107"},"url":"https:\/\/bi.unija.com\/en\/author\/branka\/"}]}},"_links":{"self":[{"href":"https:\/\/bi.unija.com\/en\/wp-json\/wp\/v2\/posts\/1964"}],"collection":[{"href":"https:\/\/bi.unija.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bi.unija.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bi.unija.com\/en\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/bi.unija.com\/en\/wp-json\/wp\/v2\/comments?post=1964"}],"version-history":[{"count":2,"href":"https:\/\/bi.unija.com\/en\/wp-json\/wp\/v2\/posts\/1964\/revisions"}],"predecessor-version":[{"id":1974,"href":"https:\/\/bi.unija.com\/en\/wp-json\/wp\/v2\/posts\/1964\/revisions\/1974"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/bi.unija.com\/en\/wp-json\/wp\/v2\/media\/1975"}],"wp:attachment":[{"href":"https:\/\/bi.unija.com\/en\/wp-json\/wp\/v2\/media?parent=1964"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bi.unija.com\/en\/wp-json\/wp\/v2\/categories?post=1964"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bi.unija.com\/en\/wp-json\/wp\/v2\/tags?post=1964"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}