Power Query: Appearing Cultured
31 October 2018
Welcome to our Power Query blog. This week, I look at how M and culture can go together.
In previous blogs, the M functions I have used have included a culture parameter. For example, in Power Query: Birthday Lists, I used the following function:
Number.From(value as any, optional culture as nullable text) as nullable number
I was converting a date to its numerical equivalent in order to create a list. I took the default local culture, but I’d like to know the other options open to me. I am going to try this with another culture to see what happens. I have a large choice of cultures. The following information comes from the Microsoft help pages:
1 When you specify es-MX or es-US in the request, the culture is converted to es-ES.
2 When you specify fr-CA in the request, the culture is converted to fr-FR.
In my blog, I wanted to convert a date to a number:
I try with another culture.
In this case, I get the same answer – however, there are many M functions that can use culture, as the following list shows:
So, I’ll try looking at the function Date.DayofWeekName:
Date.DayOfWeekName(date as any, optional culture as nullable text)
Firstly, with my local culture:
So far, so good. If I change the culture to Chinese I get
And in Urdu…
Much more satisfying results! Of course, this does leave the question of how I know the local culture that Power Query is using:
The M function
will tell me my current setting.
Come back next time for more ways to use Power Query!