Locked lesson.
About this lesson
One of the things we need to understand is how Excel interprets dates, and how we can override the defaults by setting the data's Locale.
Exercise files
There are no related exercise files for this lesson.
Quick reference
Understanding Dates and Locale
An overview of the date formats and how they are affected by locale.
When to use
When you are importing data from files with different date (or number) formats.
Instructions
Understanding Dates
Dates in Excel and Power BI are actually a serial number based on the number of days since January 1, 1900, formatted to look the way you see them.
- Using a date serial number allows us to add to or subtract from that value to return other dates
- When data is imported from other file types (such as text or CSV files), dates must be interpreted and converted into the correct date serial number
- By using date serial numbers, we are able to share the data with other parts of the world that may use a different format for displaying dates (Month/Day/Year, Day/Month/Year, Year/Month/Day, etc.)
The importance of Locale
- When importing data, Power Query will try to interpret dates using the date format from your Windows regional settings
- If your date format does not line up with the data, Power Query may get this wrong
- “Locale” is an IT term that refers to the data’s home region
- Changing Type with Locale will allow Power Query to correctly interpret the data from another region and convert it to your preferred format
Hints & tips
- You always define the locale based on the format of the SOURCE data, not your region
- Changing type with Locale allows sharing of files with other users without risking inconsistent data type imports based on their regional settings
- Locale settings can be needed for any type of data including values (Europe separates decimals using commas while North America uses periods)
- If there is any chance you will be sharing your file in the future, it is a best practice to import dates with Locale settings, even if your regional settings match the data
Lesson notes are only available for subscribers.