{"id":667,"date":"2019-03-05T11:19:14","date_gmt":"2019-03-05T17:19:14","guid":{"rendered":"http:\/\/www.sqlfreelancer.com\/blog\/?p=667"},"modified":"2019-03-05T14:40:59","modified_gmt":"2019-03-05T20:40:59","slug":"creating-a-dynamic-date-range-title-in-power-bi","status":"publish","type":"post","link":"https:\/\/www.sqlfreelancer.com\/blog\/creating-a-dynamic-date-range-title-in-power-bi\/","title":{"rendered":"Creating a Dynamic Date Range Title in Power BI"},"content":{"rendered":"\n<figure><iframe loading=\"lazy\" src=\"https:\/\/app.powerbi.com\/view?r=eyJrIjoiYjFmOGY5OTctMDFjYi00MDU4LWE3NWQtOTYzZDE5YjYyNDY4IiwidCI6ImI0MWEzMGYxLTFjMjAtNDM1Mi04NGI2LWUzYTU1NjhmMTExMCIsImMiOjJ9\" allowfullscreen=\"true\" width=\"800\" height=\"600\"><\/iframe><\/figure>\n\n\n\n<p>Creating a dynamic title in Power BI helps present the data and let&#8217;s the viewers know what the data is filtered on. In this post I\u2019ll go over how to do this\u2026<\/p>\n\n\n\n<p>I have a sales report that I\u2019d like to add a title that is based on the Order Date Slicer. Currently, the title is static text \u201cSales Report\u201d<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/PBI-Dynamic-Title-1.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"570\" src=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/PBI-Dynamic-Title-1-1024x570.png\" alt=\"\" class=\"wp-image-668\" srcset=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/PBI-Dynamic-Title-1-1024x570.png 1024w, https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/PBI-Dynamic-Title-1-300x167.png 300w, https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/PBI-Dynamic-Title-1-768x428.png 768w, https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/PBI-Dynamic-Title-1.png 1332w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption>Sales Report<\/figcaption><\/figure>\n\n\n\n<p>To create\nmy dynamic title, I\u2019ll first need to create a measure table that has my Order\nDate data. In this case, that table is FactInternetSales and the column is\nOrderDate.<\/p>\n\n\n\n<p>To create\na measure, click New Measure in the Power BI Desktop ribbon<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/PBI-Dynamic-Title-2.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"123\" src=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/PBI-Dynamic-Title-2-1024x123.png\" alt=\"\" class=\"wp-image-669\" srcset=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/PBI-Dynamic-Title-2-1024x123.png 1024w, https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/PBI-Dynamic-Title-2-300x36.png 300w, https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/PBI-Dynamic-Title-2-768x92.png 768w, https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/PBI-Dynamic-Title-2.png 1160w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption>Power BI Desktop Ribbon<\/figcaption><\/figure>\n\n\n\n<p>Next, you\u2019ll see a window where you can type code. In this example, I\u2019ll use the following DAX<\/p>\n\n\n\n<p>Next, you\u2019ll\nsee a window where you can type code. In this example, I\u2019ll use the following\nDAX<\/p>\n\n\n\n<p><em>Order Date Title = &#8220;Sales For &#8221; &amp;<br>MIN ( FactInternetSales[OrderDate] ) &amp; &#8221; to &#8220;<br>&amp; MAX ( FactInternetSales[OrderDate] )<\/em><\/p>\n\n\n\n<p>Let\u2019s\nwalk through this real quick.<\/p>\n\n\n\n<p>The first line (<em>Order Date Title = \u201cSales For \u201c &amp;<\/em>) is basically naming the measure and adding the beginning text for the title.<br> The second line (<em>MIN ( FactInternetSales[OrderDate] ) &amp; \u201c to \u201c<\/em>) is finding the minimum order date from FactInternetSales.OrderDate and then adding the \u201cto\u201d text.<br>The last line (<em>MAX ( FactInternetSales[OrderDate]<\/em> ) is finding the maximum order date from FactInternetSales.OrderDate.<\/p>\n\n\n\n<p> This one was pretty easy. Once I\u2019ve typed my DAX, hit the checkmark to make sure there are no errors and the click off screen. <\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/PBI-Dynamic-Title-3.png\"><img loading=\"lazy\" decoding=\"async\" width=\"708\" height=\"298\" src=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/PBI-Dynamic-Title-3.png\" alt=\"\" class=\"wp-image-670\" srcset=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/PBI-Dynamic-Title-3.png 708w, https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/PBI-Dynamic-Title-3-300x126.png 300w\" sizes=\"auto, (max-width: 708px) 100vw, 708px\" \/><\/a><figcaption>DAX<\/figcaption><\/figure>\n\n\n\n<p>Our measure has been created! Let\u2019s go back and find it under the FactInternetSales fields pane.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><a href=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/PBI-Dynamic-Title-4.png\"><img loading=\"lazy\" decoding=\"async\" width=\"174\" height=\"652\" src=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/PBI-Dynamic-Title-4.png\" alt=\"\" class=\"wp-image-671\" srcset=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/PBI-Dynamic-Title-4.png 174w, https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/PBI-Dynamic-Title-4-80x300.png 80w\" sizes=\"auto, (max-width: 174px) 100vw, 174px\" \/><\/a><figcaption>Power BI Fields<\/figcaption><\/figure><\/div>\n\n\n\n<p>Next, let\u2019s click on the Card Visualization and move and size it appropriately to fit in our title space.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/PBI-Dynamic-Title-5.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"127\" src=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/PBI-Dynamic-Title-5-1024x127.png\" alt=\"\" class=\"wp-image-672\" srcset=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/PBI-Dynamic-Title-5-1024x127.png 1024w, https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/PBI-Dynamic-Title-5-300x37.png 300w, https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/PBI-Dynamic-Title-5-768x95.png 768w, https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/PBI-Dynamic-Title-5.png 1368w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption>Card Visualization<\/figcaption><\/figure>\n\n\n\n<p>While the card is highlighted, click on the new measure from the Fields pane and it will populate the card with the measure we created.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/PBI-Dynamic-Title-6.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"132\" src=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/PBI-Dynamic-Title-6-1024x132.png\" alt=\"\" class=\"wp-image-673\" srcset=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/PBI-Dynamic-Title-6-1024x132.png 1024w, https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/PBI-Dynamic-Title-6-300x39.png 300w, https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/PBI-Dynamic-Title-6-768x99.png 768w, https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/PBI-Dynamic-Title-6.png 1371w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p>The only thing left to do is format the title and we\u2019re all set! If we change the Order Date Slicer, you\u2019ll notice the title changes with the date. See live example at the beginning of this post.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/PBI-Dynamic-Title-7.png\"><img loading=\"lazy\" decoding=\"async\" width=\"900\" height=\"396\" src=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/PBI-Dynamic-Title-7.png\" alt=\"\" class=\"wp-image-674\" srcset=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/PBI-Dynamic-Title-7.png 900w, https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/PBI-Dynamic-Title-7-300x132.png 300w, https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2019\/03\/PBI-Dynamic-Title-7-768x338.png 768w\" sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><\/a><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Creating a dynamic title in Power BI helps present the data and let&#8217;s the viewers know what the data is filtered on. In this post I\u2019ll go over how to do this\u2026 I have a sales report that I\u2019d like to add a title that is based on the Order Date Slicer. Currently, the title [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[30,94,127],"tags":[106,128],"class_list":["post-667","post","type-post","status-publish","format-standard","hentry","category-business-intelligence","category-development","category-power-bi","tag-business-intelligence","tag-power-bi"],"_links":{"self":[{"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/posts\/667","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/comments?post=667"}],"version-history":[{"count":4,"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/posts\/667\/revisions"}],"predecessor-version":[{"id":679,"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/posts\/667\/revisions\/679"}],"wp:attachment":[{"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/media?parent=667"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/categories?post=667"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/tags?post=667"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}