Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
TSzreder
Frequent Visitor

Dynamic date formatting based on user's browser language

Hi all,

I am supporting one of the clients that wants the date in his report to change formatting based on the user's browser language.

Theoretically this should be possible by using one of the date formats with an asterisk (*), however this does not work.

I use Polish as my locale, so the asterisk format is dd.mm.yyyy and after the publishing and changing browser language to English US, I would expect it to change to mm/d/yyyy but the format stays as dd.mm.yyyy

Any idea on how to make it work?

1 ACCEPTED SOLUTION
v-yalanwu-msft
Community Support
Community Support

Hi @TSzreder , 

Because your yellow mark is the general date format, and red is the custom date, so when you change the language, only the language difference will be displayed, and the format is custom/fixed. If you want to achieve dynamic language, you can try to use slicer or set in power query

Slicer way1:

1.Enter table as language slicer

vyalanwumsft_1-1623995429520.png

2.Create a measure

Measure =
SWITCH (
    MAX ( 'Slicer'[language] ),
    "Polish", FORMAT ( MAX ( [Date] ), "dd/mm/yyyy" ),
    "US", FORMAT ( MAX ( [Date] ), "mm/d/yyyy" )
)

The final output is shown below:

vyalanwumsft_2-1623995518866.pngvyalanwumsft_3-1623995536091.png

Power query way2:

vyalanwumsft_0-1623995340109.png

Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-yalanwu-msft
Community Support
Community Support

Hi @TSzreder , 

Because your yellow mark is the general date format, and red is the custom date, so when you change the language, only the language difference will be displayed, and the format is custom/fixed. If you want to achieve dynamic language, you can try to use slicer or set in power query

Slicer way1:

1.Enter table as language slicer

vyalanwumsft_1-1623995429520.png

2.Create a measure

Measure =
SWITCH (
    MAX ( 'Slicer'[language] ),
    "Polish", FORMAT ( MAX ( [Date] ), "dd/mm/yyyy" ),
    "US", FORMAT ( MAX ( [Date] ), "mm/d/yyyy" )
)

The final output is shown below:

vyalanwumsft_2-1623995518866.pngvyalanwumsft_3-1623995536091.png

Power query way2:

vyalanwumsft_0-1623995340109.png

Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

ibarrau
Super User
Super User

Hi. You are right about the (*) and behaviour. Please be sure that you have configured your browser properly and the general settings in the workspace is reading language as default:

ibarrau_0-1623846944408.png

 

You can get there clicking dataset Settings and change tabs.
That should work. I have my PBI Desktop in Spanish and my browser in english. I can see the difference in dates formats everyday.

I hope that helps,


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Happy to help!

LaDataWeb Blog

Thanks @ibarrau !

I checked that the setting is correct but it still doesn't work with dates... 

However, it works with datetime column, the one I have marked with yellow but the one in red still doesn't work...

TSzreder_0-1623911201864.png

Unfortunately that doesn't really solve my problem as I don't need the time part...

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors