Forum Discussion

UIUser's avatar
UIUser
Frequent Visitor
1 year ago
Solved

Date formatting in wrong way when converted to text

Hi, 

 

I have a date that I need to connect with a text piece. Now when I combine my selected date with the text the date comes out in a wrong format (US date format, MM/DD/YYYY, 1/31/2025) allthough all my regional settings are set to german / european:

Dax:

Result:

 

Originally the date column has this format (german / european) -> DD/MM/YY -> 31.01.2025

 

 Why does the text come out as US date allthough all settings are german / european format and how to change it?

 

Thanks!

  • Hi UIUser ,

     

    The issue occurs because when you concatenate a date with text in DAX, Power BI implicitly converts the date to a string using the default US format (MM/DD/YYYY), ignoring your regional settings. This happens even if your system or file is configured for German formatting. To fix this, you need to explicitly format the date before concatenation. Use the FORMAT function to define the correct European date structure. For example, instead of relying on SELECTEDVALUE to output a date directly, wrap it like this:

    header_ertragleer_previous_month = 
    "Ertrag leer per " & FORMAT(SELECTEDVALUE('bm dim_month'[month_end]), "DD.MM.YYYY")
    

    This ensures the date appears as 31.01.2025 regardless of Power BI’s internal preferences. If you want to reinforce the language tag just in case, use the following format string:

    header_ertragleer_previous_month = 
    "Ertrag leer per " & FORMAT(SELECTEDVALUE('bm dim_month'[month_end]), "[$-de-DE]dd.mm.yyyy")
    

    This forces the German locale format and avoids any surprises when the report is opened elsewhere.

     

    Best regards,

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi UIUser  ,
    Thanks for reaching out to the Microsoft fabric community forum.

    As mentioned by DataNinja777  , I tried to implement their suggestion and it has successfully worked at my end

     


    Give this a try it will most likely resolve the issue.

     

    Furthe Reading: SELECTEDVALUE function - DAX | Microsoft Learn
    FORMAT function (DAX) - DAX | Microsoft Learn


    If you find this post helpful, please mark it as an "Accept as Solution" and consider giving a KUDOS. Feel free to reach out if you need further assistance.
    Thank you

  • Hi UIUser ,

     

    The issue occurs because when you concatenate a date with text in DAX, Power BI implicitly converts the date to a string using the default US format (MM/DD/YYYY), ignoring your regional settings. This happens even if your system or file is configured for German formatting. To fix this, you need to explicitly format the date before concatenation. Use the FORMAT function to define the correct European date structure. For example, instead of relying on SELECTEDVALUE to output a date directly, wrap it like this:

    header_ertragleer_previous_month = 
    "Ertrag leer per " & FORMAT(SELECTEDVALUE('bm dim_month'[month_end]), "DD.MM.YYYY")
    

    This ensures the date appears as 31.01.2025 regardless of Power BI’s internal preferences. If you want to reinforce the language tag just in case, use the following format string:

    header_ertragleer_previous_month = 
    "Ertrag leer per " & FORMAT(SELECTEDVALUE('bm dim_month'[month_end]), "[$-de-DE]dd.mm.yyyy")
    

    This forces the German locale format and avoids any surprises when the report is opened elsewhere.

     

    Best regards,

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi UIUser 

    May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

    Thank you.