{"id":1294,"date":"2020-06-15T07:05:31","date_gmt":"2020-06-15T07:05:31","guid":{"rendered":"http:\/\/bi.unija.com\/en\/?p=1294"},"modified":"2020-08-17T13:52:31","modified_gmt":"2020-08-17T13:52:31","slug":"monthly-and-ytd-slicer-in-power-bi","status":"publish","type":"post","link":"https:\/\/bi.unija.com\/en\/monthly-and-ytd-slicer-in-power-bi\/","title":{"rendered":"Monthly and YTD Slicer in Power BI"},"content":{"rendered":"<p><em>For Power BI Desktop version 2.76.5678.782 (January\u00a02020).<\/em><\/p>\n<p>We usually want to track business data like revenue, plan and forecast on a monthly or YTD basis. YTD or <em>Year to Date<\/em> is a function, that aggregates data from the beginning of the year up to the current month. We&#8217;re usually interested in both views. We can create a slicer, that enables us to simply switch between both views.<\/p>\n<h1>Entering data with Enter Data<\/h1>\n<p>We start by creating a table in <em>Data<\/em> view of Power BI. We select <strong>Table Tools &gt; New Table<\/strong>. We enter a table as shown on the image below and name it <em>Calculation<\/em>.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"138\" height=\"74\" class=\"wp-image-1295\" src=\"https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2020\/06\/word-image-95.png\" \/><\/p>\n<p>We don&#8217;t connect the table to any of the other tables, we need it solely for the purpose of the slicer.<\/p>\n<h1>Inserting the slicer<\/h1>\n<p>We switch the view to <em>Report <\/em>and insert the slicer. We check the <em>Calculation<\/em> field on the field list and select the <em>List<\/em> view on the slicer. We change the shape of the slicer. We set the orientation to <em>Horizontal<\/em> and manually change the shape, until we get two buttons like on the image bellow.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"232\" height=\"55\" class=\"wp-image-1296\" src=\"https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2020\/06\/word-image-97.png\" \/><\/p>\n<h1>Switch function<\/h1>\n<p>We insert the SWITCH() function into a measure we want to observe. In our example we&#8217;ll use the measure <em>Actual<\/em>. We change the formula of measure Actual by inserting the following scenarios:<\/p>\n<ul>\n<li>In case of selecting <em>Monthly<\/em> in the slicer, the table <em>Calculation<\/em> will filter and the only value left in the Calculation[ID] will be 1. We&#8217;ll use 1 instruct the SWITCH() function to display the sum of current month.<\/li>\n<li>In case of selecting <em>YTD<\/em> in the slicer, the table <em>Calculation<\/em> will filter and the only value left in the Calculation[ID] will be 2. We&#8217;ll use 2 instruct the SWITCH() function to display the sum of values from the beginning of the year up to current month.<\/li>\n<\/ul>\n<p>The whole formula for the <em>Actual<\/em> or <em>AC<\/em> measure is:<\/p>\n<p><strong>AC = CALCULATE(<\/strong><\/p>\n<p><strong>switch(<\/strong><\/p>\n<p><strong>min(&#8216;Calculation'[ID]);<\/strong><\/p>\n<p><strong>1;sum(Sales[Value]);<\/strong><\/p>\n<p><strong>2; CALCULATE(sum(Sales[Value]);DATESYTD(&#8216;Calendar'[Date]))<\/strong><\/p>\n<p><strong>)<\/strong><\/p>\n<p><strong>;Sales[Scenario]=&#8221;AC&#8221;<\/strong><\/p>\n<p><strong>)<\/strong><\/p>\n<p>We can now a plot for the AC measure. Using the Monthly\/YTD slicer we can quickly observe the data in both views.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"584\" height=\"371\" class=\"wp-image-1297\" src=\"https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2020\/06\/word-image-100.png\" srcset=\"https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2020\/06\/word-image-100.png 584w, https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2020\/06\/word-image-100-300x191.png 300w\" sizes=\"(max-width: 584px) 100vw, 584px\" \/> <img loading=\"lazy\" decoding=\"async\" width=\"579\" height=\"371\" class=\"wp-image-1298\" src=\"https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2020\/06\/word-image-105.png\" srcset=\"https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2020\/06\/word-image-105.png 579w, https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2020\/06\/word-image-105-300x192.png 300w\" sizes=\"(max-width: 579px) 100vw, 579px\" \/><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>For Power BI Desktop version 2.76.5678.782 (January\u00a02020). We usually want to track business data like revenue, plan and forecast on a monthly or YTD basis. YTD or Year to Date is a function, that aggregates data from the beginning of<\/p>\n","protected":false},"author":5,"featured_media":1208,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[3],"tags":[8],"class_list":["post-1294","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-intermediate","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>Monthly and YTD Slicer in Power BI - Unija Smart<\/title>\n<meta name=\"description\" content=\"We&#039;re usually interested in monthly as well as YTD view of our business data. We can create a slicer that enables us to simply switch between both views.\" \/>\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\/monthly-and-ytd-slicer-in-power-bi\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Monthly and YTD Slicer in Power BI - Unija Smart\" \/>\n<meta property=\"og:description\" content=\"We&#039;re usually interested in monthly as well as YTD view of our business data. We can create a slicer that enables us to simply switch between both views.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/bi.unija.com\/en\/monthly-and-ytd-slicer-in-power-bi\/\" \/>\n<meta property=\"og:site_name\" content=\"Bi Unija\" \/>\n<meta property=\"article:published_time\" content=\"2020-06-15T07:05:31+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-08-17T13:52:31+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2020\/06\/ENG10.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\/monthly-and-ytd-slicer-in-power-bi\/\",\"url\":\"https:\/\/bi.unija.com\/en\/monthly-and-ytd-slicer-in-power-bi\/\",\"name\":\"Monthly and YTD Slicer in Power BI - Unija Smart\",\"isPartOf\":{\"@id\":\"https:\/\/bi.unija.com\/en\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/bi.unija.com\/en\/monthly-and-ytd-slicer-in-power-bi\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/bi.unija.com\/en\/monthly-and-ytd-slicer-in-power-bi\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2020\/06\/ENG10.jpg\",\"datePublished\":\"2020-06-15T07:05:31+00:00\",\"dateModified\":\"2020-08-17T13:52:31+00:00\",\"author\":{\"@id\":\"https:\/\/bi.unija.com\/en\/#\/schema\/person\/3bed36623727c7162e421c4366a54e10\"},\"description\":\"We're usually interested in monthly as well as YTD view of our business data. We can create a slicer that enables us to simply switch between both views.\",\"breadcrumb\":{\"@id\":\"https:\/\/bi.unija.com\/en\/monthly-and-ytd-slicer-in-power-bi\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/bi.unija.com\/en\/monthly-and-ytd-slicer-in-power-bi\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/bi.unija.com\/en\/monthly-and-ytd-slicer-in-power-bi\/#primaryimage\",\"url\":\"https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2020\/06\/ENG10.jpg\",\"contentUrl\":\"https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2020\/06\/ENG10.jpg\",\"width\":720,\"height\":480},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/bi.unija.com\/en\/monthly-and-ytd-slicer-in-power-bi\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/bi.unija.com\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Monthly and YTD Slicer 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":"Monthly and YTD Slicer in Power BI - Unija Smart","description":"We're usually interested in monthly as well as YTD view of our business data. We can create a slicer that enables us to simply switch between both views.","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\/monthly-and-ytd-slicer-in-power-bi\/","og_locale":"en_US","og_type":"article","og_title":"Monthly and YTD Slicer in Power BI - Unija Smart","og_description":"We're usually interested in monthly as well as YTD view of our business data. We can create a slicer that enables us to simply switch between both views.","og_url":"https:\/\/bi.unija.com\/en\/monthly-and-ytd-slicer-in-power-bi\/","og_site_name":"Bi Unija","article_published_time":"2020-06-15T07:05:31+00:00","article_modified_time":"2020-08-17T13:52:31+00:00","og_image":[{"width":720,"height":480,"url":"https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2020\/06\/ENG10.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\/monthly-and-ytd-slicer-in-power-bi\/","url":"https:\/\/bi.unija.com\/en\/monthly-and-ytd-slicer-in-power-bi\/","name":"Monthly and YTD Slicer in Power BI - Unija Smart","isPartOf":{"@id":"https:\/\/bi.unija.com\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/bi.unija.com\/en\/monthly-and-ytd-slicer-in-power-bi\/#primaryimage"},"image":{"@id":"https:\/\/bi.unija.com\/en\/monthly-and-ytd-slicer-in-power-bi\/#primaryimage"},"thumbnailUrl":"https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2020\/06\/ENG10.jpg","datePublished":"2020-06-15T07:05:31+00:00","dateModified":"2020-08-17T13:52:31+00:00","author":{"@id":"https:\/\/bi.unija.com\/en\/#\/schema\/person\/3bed36623727c7162e421c4366a54e10"},"description":"We're usually interested in monthly as well as YTD view of our business data. We can create a slicer that enables us to simply switch between both views.","breadcrumb":{"@id":"https:\/\/bi.unija.com\/en\/monthly-and-ytd-slicer-in-power-bi\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/bi.unija.com\/en\/monthly-and-ytd-slicer-in-power-bi\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/bi.unija.com\/en\/monthly-and-ytd-slicer-in-power-bi\/#primaryimage","url":"https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2020\/06\/ENG10.jpg","contentUrl":"https:\/\/bi.unija.com\/en\/wp-content\/uploads\/sites\/2\/2020\/06\/ENG10.jpg","width":720,"height":480},{"@type":"BreadcrumbList","@id":"https:\/\/bi.unija.com\/en\/monthly-and-ytd-slicer-in-power-bi\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/bi.unija.com\/en\/"},{"@type":"ListItem","position":2,"name":"Monthly and YTD Slicer 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\/1294"}],"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=1294"}],"version-history":[{"count":4,"href":"https:\/\/bi.unija.com\/en\/wp-json\/wp\/v2\/posts\/1294\/revisions"}],"predecessor-version":[{"id":1602,"href":"https:\/\/bi.unija.com\/en\/wp-json\/wp\/v2\/posts\/1294\/revisions\/1602"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/bi.unija.com\/en\/wp-json\/wp\/v2\/media\/1208"}],"wp:attachment":[{"href":"https:\/\/bi.unija.com\/en\/wp-json\/wp\/v2\/media?parent=1294"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bi.unija.com\/en\/wp-json\/wp\/v2\/categories?post=1294"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bi.unija.com\/en\/wp-json\/wp\/v2\/tags?post=1294"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}