Forum Discussion
Format Function With "Short Date" Not Respecting User's Locale
Hi everyone,
I would like to display a date range (text), but formatted accordingly the user's language or region settings.
This is croatian date format:
For this purpose, I've created a measure with a formula:
DateRange3 = FORMAT(DATE(2020;1;1);"short date") & " - " & FORMAT(DATE(2020;4;30);"short date")
However, the measure always displays the date range in US format, in both, PBI Desktop and Power BI Online service, no matter what language I set in the Power BI Online service or my local windows settings:
This is also true not only for date ranges (text type), but also for measures with single dates (date type).
It seems the Format function ignores the locale completely.
However, if I specify the format of a date column or measure manually as "short date", it works then.
So, this solves it for single date fields, but I cannot do that for the range measure, because Format field is disabled, because it is treated as text, not date.
Is this intended behaviour of the Format function or is it a bug, please?
If intended, is there a workaround to display a date range respecting user's local settings, please?
Here's a PBIX for details: https://drive.google.com/file/d/1iC--VQzZqNIbE2_dHOieX5zs-p8K4D-L/view?usp=sharing
Thank you and best regards,
Mihael
1 Reply
- lbendlin
Super User
I don't think "short date" is an accepted placeholder.
https://docs.microsoft.com/en-us/dax/custom-date-and-time-formats-for-the-format-function
Edit: Turns out I was wrong.
https://docs.microsoft.com/en-us/dax/pre-defined-date-and-time-formats-for-the-format-function
Maybe try the different spelling?