While working on the scenario "How to refresh dataset using button in Report view of Power BI?", We have added a DAX function UTCNOW() which will give the refresh time and date value in a card. But the value in the card will be in the UTC and we are more interested to show the value in the timezone depending upon the report user location.
For example, If report users are in India so I have to show the time in Indian standard time (+5:30 UTC). So in this article, we will see how to convert UTC to Local Time Zone using DAX in Power BI Report.
In order to convert UTC to local time zone,
1. We need to create a measure showing the Date and Time value in the UTC format.
If we place the measure in a card then we will get the Date and Time value as per the Universal Time Coordinated (UTC)
2. We need to convert the UTC time zone format to the IST time zone as our users are located in India.
In order to convert we need to create a measure IST using below mentioned DAX Code.
FORMAT ( [UTC], "mm/dd/yyyy hh:nn:ss AMPM" ) + TIME ( 5, 30, 00 )
Format Function helps to format the UTC date and Time Data in the format provided in the function. and + TIME ( 5, 30, 00 ) add the 5 hours and 30 minutes to the UTC time in order to convert to the IST time zone.
So let`s see the result of the IST measure created.
Final ThoughtsConversion of the time zone is a very practical requirement that is used very frequently. Even though there are other methods as well through the power query but I found this method very easy to implement.
Please do let me know your thoughts and if you like the article please share with your friends on Linkedin.