{"id":10194,"date":"2021-01-07T20:36:07","date_gmt":"2021-01-08T02:36:07","guid":{"rendered":"https:\/\/threecloud.wpengine.com\/post\/avoiding-issues-when-generating-time-date-in-power-bi\/"},"modified":"2022-11-30T09:24:32","modified_gmt":"2022-11-30T15:24:32","slug":"avoiding-issues-when-generating-time-date-in-power-bi","status":"publish","type":"post","link":"https:\/\/3cloudsolutions.com\/resources\/avoiding-issues-when-generating-time-date-in-power-bi\/","title":{"rendered":"Avoiding Issues When Generating Time\/Date in Power BI"},"content":{"rendered":"<p>Have you ever run into hurdles when trying to generate time and date in Power BI? I know I have, so I\u2019m here to help and to demonstrate the differences between generating time and date in Power BI Desktop vs in the Power BI Service.<\/p>\n<p>A few key points before I dig in:<\/p>\n<p>When we generate time and date in Power BI Desktop using the native Power BI tools, it pulls that information from our local computer settings.<\/p>\n<p>In the Power BI Service, the Service generally exists in a different server time and date than your local machine. Therefore, there will be some differences between the times as they appear in the desktop file and how they appear in the Service.<\/p>\n<p>Currently, there is no native functionality to handle Daylight Savings Time changes. Keep this in mind when you start to generate your own time and dates \u2013 you\u2019ll need to create tools that take this into account.<\/p>\n<p>What I\u2019ve done will be much easier to see by watching my video instead of trying to explain in text, as it could be confusing. Here\u2019s a brief overview of my video.<\/p>\n<ul>\n<li>In my video, you\u2019ll see that I went into Power Query and copied the different queries that I used to generate time and date.<\/li>\n<li>The first one is generating time and date in Power Query using DateTImeZone.LocalNow to pull the local time. Remember, when operating in the PBI Desktop, this is pulling information from my local machine.<\/li>\n<li>What I\u2019m going to do is reuse some of the formulas and look at how we can switch the time and what those changes look like as I go through the queries I\u2019ve highlighted.<\/li>\n<li>In my demo, you\u2019ll see that rather than publishing this file and jumping in the Power BI Service to look at it, I\u2019ve taken the queries that I\u2019ve used to generate my times, put them in the Service as a data flow, and then imported that dataflow into a Power BI Desktop file.<\/li>\n<li>So, I have 2 pages; one shows the information from the data flow and the other is the information generated locally. This way I can show side by side what the changes are going to look like.<\/li>\n<li>I\u2019ll walk you through the steps of these scenarios and the queries I used:\n<ul>\n<li>Manually switching time using #duration<\/li>\n<li>Modifying date\/time to reflect Eastern Standard Time (-4 UTC) using SwitchZone<\/li>\n<li>Modifying time\/date in Power Query using SwitchZone and FixedLocalNow (time at start of query execution)<\/li>\n<li>Adjusting time -4 or -5 based on daylight saving calendar<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><iframe loading=\"lazy\" src=\"https:\/\/www.youtube.com\/embed\/FpnbnkVzkGg\" width=\"560\" height=\"315\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n<p>In summary, this post covers the changes to date\/time as we move from Power BI Desktop to the Service and what are the best formulas to use when we are generating our own time. You\u2019ll see that the key takeaway is the best way is to use SwitchZone when adjusting between the Desktop and the Service.<\/p>\n<p>I think you\u2019ll find this helpful when running into date\/time hurdles in Power BI.<\/p>\n<p>Need further help? Our expert team and solution offerings can help your business with any Azure product or service, including Managed Services offerings. Contact us at 888-8AZURE or\u00a0 <a href=\"mailto:sales@3cloudsolutions.com\">sales@3cloudsolutions.com<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Have you ever run into hurdles when trying to generate time and date in Power&mldr;<\/p>\n","protected":false},"author":31,"featured_media":10855,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"content-type":"","footnotes":""},"categories":[260],"tags":[],"class_list":["post-10194","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-data-ai","topics-blog"],"acf":[],"_links":{"self":[{"href":"https:\/\/3cloudsolutions.com\/wp-json\/wp\/v2\/posts\/10194","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/3cloudsolutions.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/3cloudsolutions.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/3cloudsolutions.com\/wp-json\/wp\/v2\/users\/31"}],"replies":[{"embeddable":true,"href":"https:\/\/3cloudsolutions.com\/wp-json\/wp\/v2\/comments?post=10194"}],"version-history":[{"count":0,"href":"https:\/\/3cloudsolutions.com\/wp-json\/wp\/v2\/posts\/10194\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/3cloudsolutions.com\/wp-json\/wp\/v2\/media\/10855"}],"wp:attachment":[{"href":"https:\/\/3cloudsolutions.com\/wp-json\/wp\/v2\/media?parent=10194"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/3cloudsolutions.com\/wp-json\/wp\/v2\/categories?post=10194"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/3cloudsolutions.com\/wp-json\/wp\/v2\/tags?post=10194"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}