{"id":3918,"date":"2022-01-11T18:49:41","date_gmt":"2022-01-12T02:49:41","guid":{"rendered":"https:\/\/SUMMALAI.COM\/?p=3918"},"modified":"2022-01-11T18:49:43","modified_gmt":"2022-01-12T02:49:43","slug":"how-to-use-datediff-to-calculate-date-and-fiscal-date-in-a-year","status":"publish","type":"post","link":"https:\/\/SUMMALAI.COM\/?p=3918","title":{"rendered":"How to Use DATEDIFF to Calculate Date # and Fiscal Date # in a Year"},"content":{"rendered":"\n<p>DATEDIFF  returns the count of interval boundaries crossed between two dates.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"syntax\"><a href=\"https:\/\/docs.microsoft.com\/en-us\/dax\/datediff-function-dax#syntax\"><\/a>Syntax<\/h2>\n\n\n\n<p>DAXCopy<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>DATEDIFF(&lt;start_date&gt;, &lt;end_date&gt;, &lt;interval&gt;)  \n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"parameters\"><a href=\"https:\/\/docs.microsoft.com\/en-us\/dax\/datediff-function-dax#parameters\"><\/a>Parameters<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Term<\/th><th>Definition<\/th><\/tr><\/thead><tbody><tr><td>start_date<\/td><td>A scalar datetime value.<\/td><\/tr><tr><td>end_date<\/td><td>A scalar datetime value Return value.<\/td><\/tr><tr><td>interval<\/td><td>The interval to use when comparing dates. The value can be one of the following:<br><br>&#8211; SECOND<br>&#8211; MINUTE<br>&#8211; HOUR<br>&#8211; DAY<br>&#8211; WEEK<br>&#8211; MONTH<br>&#8211; QUARTER<br>&#8211; YEAR<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>Below, see a sample to calculate Date # and Fiscal Date # in a Year.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"391\" src=\"https:\/\/SUMMALAI.COM\/wp-content\/uploads\/2022\/01\/Ficial-DateNo-1024x391.png\" alt=\"\" class=\"wp-image-3919\" srcset=\"https:\/\/SUMMALAI.COM\/wp-content\/uploads\/2022\/01\/Ficial-DateNo-1024x391.png 1024w, https:\/\/SUMMALAI.COM\/wp-content\/uploads\/2022\/01\/Ficial-DateNo-300x115.png 300w, https:\/\/SUMMALAI.COM\/wp-content\/uploads\/2022\/01\/Ficial-DateNo-768x294.png 768w, https:\/\/SUMMALAI.COM\/wp-content\/uploads\/2022\/01\/Ficial-DateNo.png 1499w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>DateNo = DATEDIFF(DATE(YEAR(&#8216;Calendar'[Date]),1,1),&#8217;Calendar'[Date],DAY)+1<\/p>\n\n\n\n<p>Below, are the sample for calculate the Fiscal Date Number (Fiscal Year starting on Feb 1) <\/p>\n\n\n\n<p>Fiscal_DateNo =<br>IF(&#8216;Calendar'[DateNo]&gt;31,&#8217;Calendar'[DateNo]-31,<br>DATEDIFF(DATE(YEAR(&#8216;Calendar'[Date])-1,2,1),Date(YEAR(&#8216;Calendar'[Date])-1,12,31),DAY)+DATEDIFF(DATE(YEAR(&#8216;Calendar'[Date]),1,1),&#8217;Calendar'[Date],DAY)+2)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>DATEDIFF returns the count of interval boundaries crossed between two dates. Syntax DAXCopy Parameters Term Definition start_date A scalar datetime value. end_date A scalar datetime value Return value. interval The interval to use when comparing dates. The value can be one of the following: &#8211; SECOND&#8211; MINUTE&#8211; HOUR&#8211; DAY&#8211; WEEK&#8211; MONTH&#8211; QUARTER&#8211; YEAR Below, see <a class=\"read-more\" href=\"https:\/\/SUMMALAI.COM\/?p=3918\">Read More<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[10,621],"tags":[1045,1044],"class_list":["post-3918","post","type-post","status-publish","format-standard","hentry","category-microsoft","category-power-bi","tag-date-and-fiscal-date-in-a-year","tag-datediff"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts\/3918","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3918"}],"version-history":[{"count":1,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts\/3918\/revisions"}],"predecessor-version":[{"id":3920,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts\/3918\/revisions\/3920"}],"wp:attachment":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3918"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3918"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3918"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}