{"id":1229,"date":"2020-06-14T20:14:39","date_gmt":"2020-06-14T20:14:39","guid":{"rendered":"http:\/\/bi.unija.com\/en\/?p=1229"},"modified":"2020-08-17T13:50:28","modified_gmt":"2020-08-17T13:50:28","slug":"calendar-in-power-bi","status":"publish","type":"post","link":"https:\/\/bi.unija.com\/en\/calendar-in-power-bi\/","title":{"rendered":"Calendar in Power BI"},"content":{"rendered":"<p><em>In this article we&#8217;ll discuss what the calendar table looks like and how to use it in Power BI model.<\/em><\/p>\n<p>Calendar table is the most important part of Power BI model. Every data table usually contains dates, which means we can connect it to calendar table and filter or aggregate it using date fields (months, days, years etc.). For example, we can check the sum income in September, or cost in 2019.<\/p>\n<p>Power BI recognizes dates in our data and generates a hidden calendar table for every date column in our data. Usually we have more than one date filed in our table, for example Date, OrderDate and PaymentDate. Power BI would generate three separate hidden calendar tables in this case, one for each date field. This would slow down our model. Good practice is to disable automatic calendar tables in settings and to make one ourselves. We can turn off this setting on <strong>File &gt;\u00a0Options\u00a0&gt; Data\u00a0Load\u00a0&gt;\u00a0Auto\u00a0date\/time\u00a0for\u00a0new\u00a0files<\/strong>.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"683\" height=\"660\" class=\"wp-image-1230\" src=\"https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2020\/06\/c-users-brankat-appdata-local-microsoft-windows-i-2.png\" alt=\"C:\\Users\\brankat\\AppData\\Local\\Microsoft\\Windows\\INetCache\\Content.MSO\\F4A7BA77.tmp\" srcset=\"https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2020\/06\/c-users-brankat-appdata-local-microsoft-windows-i-2.png 683w, https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2020\/06\/c-users-brankat-appdata-local-microsoft-windows-i-2-300x290.png 300w\" sizes=\"(max-width: 683px) 100vw, 683px\" \/><em>Turning off the functionality that generates a calendar table for each date field in our data.<\/em><\/p>\n<p>You can find more on good practice in setting Power BI Desktop in article Preparing Work Environment in Power BI.<\/p>\n<h1>What calendar table looks like<\/h1>\n<p>Calendar table consists of all the dates from earliest to latest year that appears in the data model. For example, if earliest and latest year in our model are 2010 and 2020, our calendar table will consist of all the dates between 1\/1\/2010 and 12\/31\/2020, even if all the dates don&#8217;t appear in our data. Table will also have date attributes like day, month, quarter, year, etc.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"312\" height=\"446\" class=\"wp-image-1231\" src=\"https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2020\/06\/word-image-3.png\" srcset=\"https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2020\/06\/word-image-3.png 312w, https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2020\/06\/word-image-3-210x300.png 210w\" sizes=\"(max-width: 312px) 100vw, 312px\" \/><\/p>\n<p><em>Calendar table.<\/em><\/p>\n<h1>How to use calendar table<\/h1>\n<h2>Connecting tables: filtering and aggregating<\/h2>\n<p>There are two types of tables<em>: fact tables<\/em> and <em>dimension tables<\/em>. Fact tables usually contain all the records of a business, for example all the items sold in a supermarket. Dimension tables describe the data in fact tables with attributes like where, who, when, etc.<\/p>\n<p>Calendar table is a dimension table. We connect it to fact table and use it to filter and aggregate data in a certain time period. If we have multiple fact tables, we can connect to all of them using one calendar table to filter more fact tables at once, for example Actual <em>and <\/em>Plan in September 2019.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1009\" height=\"703\" class=\"wp-image-1232\" src=\"https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2020\/06\/c-users-brankat-appdata-local-microsoft-windows-i-3.png\" alt=\"C:\\Users\\brankat\\AppData\\Local\\Microsoft\\Windows\\INetCache\\Content.MSO\\C1C2B2AF.tmp\" srcset=\"https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2020\/06\/c-users-brankat-appdata-local-microsoft-windows-i-3.png 1009w, https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2020\/06\/c-users-brankat-appdata-local-microsoft-windows-i-3-300x209.png 300w, https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2020\/06\/c-users-brankat-appdata-local-microsoft-windows-i-3-768x535.png 768w\" sizes=\"(max-width: 1009px) 100vw, 1009px\" \/><em>Calendar table is used to filter big fact tables.<\/em><\/p>\n<h2>Time intelligence functions<\/h2>\n<p>There are many time analysis functions available in Power BI. We can use function <strong>CALENDAR(<\/strong>StartDate, EndDate<strong>)<\/strong>, that creates a table of all the dates between StartDate and EndDate. Another useful function is <strong>CALENDARAUTO()<\/strong>, that recognizes earliest and latest date in our data model and creates a table of the dates in between.<\/p>\n<p>The best calendar table is one we make ourselves. In our next article, <a href=\"https:\/\/bi.unija.com\/en\/dynamic-calendar-in-power-query\/\">Dynamic Calendar in Power Query<\/a>, we will show how we can make our own calendar tables and avoid common problems that occur with functions like <strong>CALENDARAUTO()<\/strong>.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this article we&#8217;ll discuss what the calendar table looks like and how to use it in Power BI model. Calendar table is the most important part of Power BI model. Every data table usually contains dates, which means we<\/p>\n","protected":false},"author":5,"featured_media":1215,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[2],"tags":[6,8],"class_list":["post-1229","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-basic","tag-calendar","tag-power-bi"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Calendar 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\/calendar-in-power-bi\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Calendar in Power BI - Bi Unija\" \/>\n<meta property=\"og:description\" content=\"In this article we&#8217;ll discuss what the calendar table looks like and how to use it in Power BI model. Calendar table is the most important part of Power BI model. Every data table usually contains dates, which means we\" \/>\n<meta property=\"og:url\" content=\"https:\/\/bi.unija.com\/en\/calendar-in-power-bi\/\" \/>\n<meta property=\"og:site_name\" content=\"Bi Unija\" \/>\n<meta property=\"article:published_time\" content=\"2020-06-14T20:14:39+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-08-17T13:50:28+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2020\/06\/ENG3.jpg\" \/>\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\/jpeg\" \/>\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\/calendar-in-power-bi\/\",\"url\":\"https:\/\/bi.unija.com\/en\/calendar-in-power-bi\/\",\"name\":\"Calendar in Power BI - Bi Unija\",\"isPartOf\":{\"@id\":\"https:\/\/bi.unija.com\/en\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/bi.unija.com\/en\/calendar-in-power-bi\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/bi.unija.com\/en\/calendar-in-power-bi\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2020\/06\/ENG3.jpg\",\"datePublished\":\"2020-06-14T20:14:39+00:00\",\"dateModified\":\"2020-08-17T13:50:28+00:00\",\"author\":{\"@id\":\"https:\/\/bi.unija.com\/en\/#\/schema\/person\/3bed36623727c7162e421c4366a54e10\"},\"breadcrumb\":{\"@id\":\"https:\/\/bi.unija.com\/en\/calendar-in-power-bi\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/bi.unija.com\/en\/calendar-in-power-bi\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/bi.unija.com\/en\/calendar-in-power-bi\/#primaryimage\",\"url\":\"https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2020\/06\/ENG3.jpg\",\"contentUrl\":\"https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2020\/06\/ENG3.jpg\",\"width\":720,\"height\":480},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/bi.unija.com\/en\/calendar-in-power-bi\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/bi.unija.com\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Calendar 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":"Calendar 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\/calendar-in-power-bi\/","og_locale":"en_US","og_type":"article","og_title":"Calendar in Power BI - Bi Unija","og_description":"In this article we&#8217;ll discuss what the calendar table looks like and how to use it in Power BI model. Calendar table is the most important part of Power BI model. Every data table usually contains dates, which means we","og_url":"https:\/\/bi.unija.com\/en\/calendar-in-power-bi\/","og_site_name":"Bi Unija","article_published_time":"2020-06-14T20:14:39+00:00","article_modified_time":"2020-08-17T13:50:28+00:00","og_image":[{"width":720,"height":480,"url":"https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2020\/06\/ENG3.jpg","type":"image\/jpeg"}],"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\/calendar-in-power-bi\/","url":"https:\/\/bi.unija.com\/en\/calendar-in-power-bi\/","name":"Calendar in Power BI - Bi Unija","isPartOf":{"@id":"https:\/\/bi.unija.com\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/bi.unija.com\/en\/calendar-in-power-bi\/#primaryimage"},"image":{"@id":"https:\/\/bi.unija.com\/en\/calendar-in-power-bi\/#primaryimage"},"thumbnailUrl":"https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2020\/06\/ENG3.jpg","datePublished":"2020-06-14T20:14:39+00:00","dateModified":"2020-08-17T13:50:28+00:00","author":{"@id":"https:\/\/bi.unija.com\/en\/#\/schema\/person\/3bed36623727c7162e421c4366a54e10"},"breadcrumb":{"@id":"https:\/\/bi.unija.com\/en\/calendar-in-power-bi\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/bi.unija.com\/en\/calendar-in-power-bi\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/bi.unija.com\/en\/calendar-in-power-bi\/#primaryimage","url":"https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2020\/06\/ENG3.jpg","contentUrl":"https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2020\/06\/ENG3.jpg","width":720,"height":480},{"@type":"BreadcrumbList","@id":"https:\/\/bi.unija.com\/en\/calendar-in-power-bi\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/bi.unija.com\/en\/"},{"@type":"ListItem","position":2,"name":"Calendar 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\/1229"}],"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=1229"}],"version-history":[{"count":2,"href":"https:\/\/bi.unija.com\/en\/wp-json\/wp\/v2\/posts\/1229\/revisions"}],"predecessor-version":[{"id":1374,"href":"https:\/\/bi.unija.com\/en\/wp-json\/wp\/v2\/posts\/1229\/revisions\/1374"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/bi.unija.com\/en\/wp-json\/wp\/v2\/media\/1215"}],"wp:attachment":[{"href":"https:\/\/bi.unija.com\/en\/wp-json\/wp\/v2\/media?parent=1229"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bi.unija.com\/en\/wp-json\/wp\/v2\/categories?post=1229"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bi.unija.com\/en\/wp-json\/wp\/v2\/tags?post=1229"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}