{"id":11550,"date":"2024-10-24T06:17:05","date_gmt":"2024-10-24T06:17:05","guid":{"rendered":"https:\/\/www.bacancytechnology.com\/qanda\/?p=11550"},"modified":"2024-10-24T06:17:05","modified_gmt":"2024-10-24T06:17:05","slug":"format-a-date-in-a-power-bi-measure","status":"publish","type":"post","link":"https:\/\/www.bacancytechnology.com\/qanda\/qa-automation\/format-a-date-in-a-power-bi-measure","title":{"rendered":"Format a Date in a Power BI Measure"},"content":{"rendered":"<p>You can use the FORMAT function in DAX to control how dates are displayed in Power BI measures. Here\u2019s a simple example:<\/p>\n<h3>DAX:<\/h3>\n<p><code>FormattedDate = FORMAT([DateColumn], \"MMMM DD, YYYY\")<\/code><\/p>\n<p>This will format your date as &#8220;October 23, 2024&#8221; (Month Day, Year). You can use different format strings depending on your needs:<\/p>\n<ul>\n<li><strong>&#8220;MM\/DD\/YYYY&#8221; <\/strong>for Month\/Day\/Year (e.g., 10\/23\/2024)<\/li>\n<li><strong>&#8220;DD-MM-YYYY&#8221;<\/strong> for Day-Month-Year (e.g., 23-10-2024)<\/li>\n<li><strong>&#8220;YYYY-MM-DD&#8221;<\/strong> for Year-Month-Day (e.g., 2024-10-23)<\/li>\n<\/ul>\n<p>If you&#8217;re working with null or blank values, you can handle them like this:<\/p>\n<h3>DAX:<\/h3>\n<p><code>FormattedDateWithCheck = IF(ISBLANK([DateColumn]), \"No Date\", FORMAT([DateColumn], \"MMMM DD, YYYY\"))<\/code><\/p>\n<p>This ensures that blank values are displayed as &#8220;No Date&#8221; instead of causing errors.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>You can use the FORMAT function in DAX to control how dates are displayed in Power BI measures. Here\u2019s a simple example: DAX: FormattedDate = FORMAT([DateColumn], &#8220;MMMM DD, YYYY&#8221;) This will format your date as &#8220;October 23, 2024&#8221; (Month Day, Year). You can use different format strings depending on your needs: &#8220;MM\/DD\/YYYY&#8221; for Month\/Day\/Year (e.g., [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":11551,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[24],"tags":[],"class_list":["post-11550","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-qa-automation"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/posts\/11550"}],"collection":[{"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/comments?post=11550"}],"version-history":[{"count":1,"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/posts\/11550\/revisions"}],"predecessor-version":[{"id":11552,"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/posts\/11550\/revisions\/11552"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/media\/11551"}],"wp:attachment":[{"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/media?parent=11550"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/categories?post=11550"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/tags?post=11550"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}