{"id":97,"date":"2026-02-26T07:48:26","date_gmt":"2026-02-26T07:48:26","guid":{"rendered":"https:\/\/gigz.pk\/powerbi\/?post_type=lesson&#038;p=97"},"modified":"2026-03-17T06:44:30","modified_gmt":"2026-03-17T06:44:30","slug":"sameperiodlastyear","status":"publish","type":"lesson","link":"https:\/\/gigz.pk\/powerbi\/lesson\/sameperiodlastyear\/","title":{"rendered":"SAMEPERIODLASTYEAR"},"content":{"rendered":"\n<p>The <strong>SAMEPERIODLASTYEAR<\/strong> function is a DAX time intelligence function used to compare values for the same period in the previous year. It is commonly used to analyze trends and year-over-year (YoY) performance.<\/p>\n\n\n\n<p>This function works only with a <strong>Date Table<\/strong> that is marked as a Date Table in Power BI.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Syntax<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">SAMEPERIODLASTYEAR(&lt;dates&gt;)<\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>dates<\/strong> \u2013 A column from your Date Table containing the dates to shift back one year.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Example 1 \u2013 Basic Year-over-Year Sales<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">Sales LY = CALCULATE(<br>    SUM(Sales[Amount]),<br>    SAMEPERIODLASTYEAR(DateTable[Date])<br>)<\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>This measure calculates total sales for the same period in the previous year.<\/li>\n\n\n\n<li>If you filter the report to March 2024, the measure will return total sales for March 2023.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Example 2 \u2013 Comparing YTD with Previous Year<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">Sales YTD LY = CALCULATE(<br>    TOTALYTD(SUM(Sales[Amount]), DateTable[Date]),<br>    SAMEPERIODLASTYEAR(DateTable[Date])<br>)<\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>This measure calculates <strong>Year-to-Date sales for the previous year<\/strong>.<\/li>\n\n\n\n<li>Useful for comparing cumulative performance over time.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">How It Works<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>SAMEPERIODLASTYEAR shifts the filter context back by one year.<\/li>\n\n\n\n<li>It respects the existing filters in visuals or slicers.<\/li>\n\n\n\n<li>Works with <strong>measures<\/strong> rather than calculated columns because it depends on filter context.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Best Practices<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Always use a dedicated <strong>Date Table<\/strong> with continuous dates.<\/li>\n\n\n\n<li>Mark the Date Table as a Date Table to enable correct time intelligence calculations.<\/li>\n\n\n\n<li>Combine SAMEPERIODLASTYEAR with CALCULATE to perform meaningful aggregations.<\/li>\n\n\n\n<li>Use in combination with visuals like line charts to highlight year-over-year trends.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>SAMEPERIODLASTYEAR is an essential DAX function for year-over-year analysis in Power BI. It allows you to compare performance dynamically across periods, helping to identify trends and monitor business growth over time.<\/p>\n\n\n\n<div class=\"schema-faq wp-block-yoast-faq-block\"><div class=\"schema-faq-section\" id=\"faq-question-1773729796656\"><strong class=\"schema-faq-question\"><\/strong> <p class=\"schema-faq-answer\"><\/p> <\/div> <\/div>\n\n\n<div class=\"yoast-breadcrumbs\"><span><span><a href=\"https:\/\/gigz.pk\/powerbi\/\">Home<\/a><\/span> \u00bb <span class=\"breadcrumb_last\" aria-current=\"page\">Power BI DAX Mastery > Time Intelligence > SAMEPERIODLASTYEAR<\/span><\/span><\/div>","protected":false},"menu_order":34,"template":"","class_list":["post-97","lesson","type-lesson","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>SAMEPERIODLASTYEAR - Power BI Learning Hub<\/title>\n<meta name=\"description\" content=\"Compare year-over-year performance in Power BI using SAMEPERIODLASTYEAR. Learn syntax and examples for YoY analysis.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/gigz.pk\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SAMEPERIODLASTYEAR - Power BI Learning Hub\" \/>\n<meta property=\"og:description\" content=\"Compare year-over-year performance in Power BI using SAMEPERIODLASTYEAR. Learn syntax and examples for YoY analysis.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/gigz.pk\/\" \/>\n<meta property=\"og:site_name\" content=\"Power BI Learning Hub\" \/>\n<meta property=\"article:modified_time\" content=\"2026-03-17T06:44:30+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":[\"WebPage\",\"FAQPage\"],\"@id\":\"https:\\\/\\\/gigz.pk\\\/powerbi\\\/lesson\\\/sameperiodlastyear\\\/\",\"url\":\"https:\\\/\\\/gigz.pk\\\/\",\"name\":\"SAMEPERIODLASTYEAR - Power BI Learning Hub\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/gigz.pk\\\/powerbi\\\/#website\"},\"datePublished\":\"2026-02-26T07:48:26+00:00\",\"dateModified\":\"2026-03-17T06:44:30+00:00\",\"description\":\"Compare year-over-year performance in Power BI using SAMEPERIODLASTYEAR. Learn syntax and examples for YoY analysis.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/gigz.pk\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/gigz.pk\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/gigz.pk\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/gigz.pk\\\/powerbi\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Power BI DAX Mastery > Time Intelligence > SAMEPERIODLASTYEAR\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/gigz.pk\\\/powerbi\\\/#website\",\"url\":\"https:\\\/\\\/gigz.pk\\\/powerbi\\\/\",\"name\":\"Power BI Learning Hub\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/gigz.pk\\\/powerbi\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"SAMEPERIODLASTYEAR - Power BI Learning Hub","description":"Compare year-over-year performance in Power BI using SAMEPERIODLASTYEAR. Learn syntax and examples for YoY analysis.","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:\/\/gigz.pk\/","og_locale":"en_US","og_type":"article","og_title":"SAMEPERIODLASTYEAR - Power BI Learning Hub","og_description":"Compare year-over-year performance in Power BI using SAMEPERIODLASTYEAR. Learn syntax and examples for YoY analysis.","og_url":"https:\/\/gigz.pk\/","og_site_name":"Power BI Learning Hub","article_modified_time":"2026-03-17T06:44:30+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":["WebPage","FAQPage"],"@id":"https:\/\/gigz.pk\/powerbi\/lesson\/sameperiodlastyear\/","url":"https:\/\/gigz.pk\/","name":"SAMEPERIODLASTYEAR - Power BI Learning Hub","isPartOf":{"@id":"https:\/\/gigz.pk\/powerbi\/#website"},"datePublished":"2026-02-26T07:48:26+00:00","dateModified":"2026-03-17T06:44:30+00:00","description":"Compare year-over-year performance in Power BI using SAMEPERIODLASTYEAR. Learn syntax and examples for YoY analysis.","breadcrumb":{"@id":"https:\/\/gigz.pk\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/gigz.pk\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/gigz.pk\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/gigz.pk\/powerbi\/"},{"@type":"ListItem","position":2,"name":"Power BI DAX Mastery > Time Intelligence > SAMEPERIODLASTYEAR"}]},{"@type":"WebSite","@id":"https:\/\/gigz.pk\/powerbi\/#website","url":"https:\/\/gigz.pk\/powerbi\/","name":"Power BI Learning Hub","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/gigz.pk\/powerbi\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/gigz.pk\/powerbi\/wp-json\/wp\/v2\/lesson\/97","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gigz.pk\/powerbi\/wp-json\/wp\/v2\/lesson"}],"about":[{"href":"https:\/\/gigz.pk\/powerbi\/wp-json\/wp\/v2\/types\/lesson"}],"wp:attachment":[{"href":"https:\/\/gigz.pk\/powerbi\/wp-json\/wp\/v2\/media?parent=97"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}