{"id":3556,"date":"2021-09-06T11:16:47","date_gmt":"2021-09-06T18:16:47","guid":{"rendered":"https:\/\/SUMMALAI.COM\/?p=3556"},"modified":"2021-09-06T11:16:48","modified_gmt":"2021-09-06T18:16:48","slug":"how-to-calculate-number-of-days-between-two-dates-in-power-bi","status":"publish","type":"post","link":"https:\/\/SUMMALAI.COM\/?p=3556","title":{"rendered":"How to Calculate Number of Days Between Two Dates in Power BI"},"content":{"rendered":"\n<p><strong>Problem<\/strong>:<\/p>\n\n\n\n<p>I have a table with customer information, including a target start date of the contract and the actual start date. I would like to add an additional column showing the number of days the contract actually started before (negative number) of after (positive number) the target start date. <\/p>\n\n\n\n<p><strong>Solution1:<\/strong><\/p>\n\n\n\n<p>You can create a calculated column. Right click on the table, select &#8220;New Column&#8221;, in the formula section you can use<\/p>\n\n\n\n<p>Column Name = 1. * (Table[actual start date] &#8211; Table[target start date])<\/p>\n\n\n\n<p>This should give you a negative number of days between the two dates.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p> <strong>Solution2<\/strong>:<\/p>\n\n\n\n<p>you can create a measure by using a similar formula as solution 1. <\/p>\n\n\n\n<p><\/p>\n\n\n\n<p> <strong>Solution<\/strong>3: <\/p>\n\n\n\n<p>You can also use the Dax expression DatesBetween Documentation is found&nbsp;<a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/ee634557.aspx\" target=\"_blank\" rel=\"noreferrer noopener\">here<\/a>.<\/p>\n\n\n\n<p>Days Between = DATESBETWEEN( &#8216;Table'[Dates], &#8216;Table'[Start Date], &#8216;Table[End Date] ) &nbsp;<\/p>\n\n\n\n<p>This will return a single number for the number of days between the two dates.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>Ref: https:\/\/community.powerbi.com\/t5\/Desktop\/calculate-number-of-days-between-2-dates\/m-p\/51213<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Problem: I have a table with customer information, including a target start date of the contract and the actual start date. I would like to add an additional column showing the number of days the contract actually started before (negative number) of after (positive number) the target start date. Solution1: You can create a calculated <a class=\"read-more\" href=\"https:\/\/SUMMALAI.COM\/?p=3556\">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":[838,837,839],"class_list":["post-3556","post","type-post","status-publish","format-standard","hentry","category-microsoft","category-power-bi","tag-number-of-days-between-two-dates","tag-number-of-days-between-two-dates-in-power-bi","tag-number-of-days-power-bi"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts\/3556","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=3556"}],"version-history":[{"count":1,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts\/3556\/revisions"}],"predecessor-version":[{"id":3557,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts\/3556\/revisions\/3557"}],"wp:attachment":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3556"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3556"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3556"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}