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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
MarkH
Helper I
Helper I

Date format issue in Power Bi Desktop in UK - some dates get converted to US format.

Here is the source data.

 

Just Source = DATATABLE (
    "StartDate", DATETIME,
    "EndDate", DATETIME,
    {
        { "16/03/2023 09:00", "16/03/2023 17:30" },
        { "16/03/2023 14:00", "16/03/2023 17:30" },
        { "17/03/2023 09:30", "17/03/2023 12:30" },
        { "16/03/2023 09:00", "17/03/2023 17:00" },
        { "16/03/2023 09:00", "20/03/2023 17:00" },
        { "16/03/2023 09:00", "20/03/2023 12:30" },
        { "16/03/2023 14:30", "20/03/2023 12:30" },
        { "17/03/2023 14:30", "20/03/2023 12:30" },
        { "16/03/2023 09:00", "27/03/2023 17:00" },
        { "02/03/2023 09:00", "27/03/2023 17:00" }
    }
)
 
Every thing is fine in the desktop  except the very last StartDate. 02/03/2023
This actually shows as 03/02/2023. All the other dates return UK format just fine.
Testing shows that if the first 2 digits are 01 to 12 it converts to US format.
I know you can change the locale in Power query but this is pure DAX.
To be clear, my locale is UK.
Why is it not consistent at keeping UK format?
How to fix it please.
 
Thanks
 
 
1 ACCEPTED SOLUTION
v-heq-msft
Community Support
Community Support

Hi @MarkH ,

Here some steps that I want to share, you can check them if they suitable for your requirement.

Using DAX to create a calculate table:

 

Just Source = DATATABLE (
    "StartDate", DATETIME,
    "EndDate", DATETIME,
    {
        { "16/03/2023 09:00", "16/03/2023 17:30" },
        { "16/03/2023 14:00", "16/03/2023 17:30" },
        { "17/03/2023 09:30", "17/03/2023 12:30" },
        { "16/03/2023 09:00", "17/03/2023 17:00" },
        { "16/03/2023 09:00", "20/03/2023 17:00" },
        { "16/03/2023 09:00", "20/03/2023 12:30" },
        { "16/03/2023 14:30", "20/03/2023 12:30" },
        { "17/03/2023 14:30", "20/03/2023 12:30" },
        { "16/03/2023 09:00", "27/03/2023 17:00" },
        { "02/03/2023 09:00", "27/03/2023 17:00" }
    }
)

 

1.Select the field in the Modeling view, and then select the dropdown arrow under Format in the Properties pane.

vheqmsft_1-1703671024721.png

2.Once you've selected Custom from the Format dropdown menu, choose from a list of firstformat.

vheqmsft_0-1703671116860.png

3.Repeat the step1 and 2 and apply to another column

4.Final output

vheqmsft_1-1703671137443.png

Best Regards,

Albert He

View solution in original post

5 REPLIES 5
v-heq-msft
Community Support
Community Support

Hi @MarkH ,

Here some steps that I want to share, you can check them if they suitable for your requirement.

Using DAX to create a calculate table:

 

Just Source = DATATABLE (
    "StartDate", DATETIME,
    "EndDate", DATETIME,
    {
        { "16/03/2023 09:00", "16/03/2023 17:30" },
        { "16/03/2023 14:00", "16/03/2023 17:30" },
        { "17/03/2023 09:30", "17/03/2023 12:30" },
        { "16/03/2023 09:00", "17/03/2023 17:00" },
        { "16/03/2023 09:00", "20/03/2023 17:00" },
        { "16/03/2023 09:00", "20/03/2023 12:30" },
        { "16/03/2023 14:30", "20/03/2023 12:30" },
        { "17/03/2023 14:30", "20/03/2023 12:30" },
        { "16/03/2023 09:00", "27/03/2023 17:00" },
        { "02/03/2023 09:00", "27/03/2023 17:00" }
    }
)

 

1.Select the field in the Modeling view, and then select the dropdown arrow under Format in the Properties pane.

vheqmsft_1-1703671024721.png

2.Once you've selected Custom from the Format dropdown menu, choose from a list of firstformat.

vheqmsft_0-1703671116860.png

3.Repeat the step1 and 2 and apply to another column

4.Final output

vheqmsft_1-1703671137443.png

Best Regards,

Albert He

MarkH
Helper I
Helper I

however, that creates the columns as text & when you convert them to datetime the original problem reappears 😪

MarkH
Helper I
Helper I

Fixed it by not using DATATABLE  and forcing a format. (You cannot format using DATATABLE)

 

Source2 = UNION (
    ROW ( "StartDate", FORMAT("16/03/2023 09:00", "dd/mm/yyyy hh:mm"), "EndDate", FORMAT("16/03/2023 17:30", "dd/mm/yyyy hh:mm") ),
    ROW ( "StartDate", FORMAT("16/03/2023 14:00", "dd/mm/yyyy hh:mm"), "EndDate", FORMAT("16/03/2023 17:30", "dd/mm/yyyy hh:mm") ),
    ROW ( "StartDate", FORMAT("17/03/2023 09:30", "dd/mm/yyyy hh:mm"), "EndDate", FORMAT("17/03/2023 12:30", "dd/mm/yyyy hh:mm") ),
    ROW ( "StartDate", FORMAT("16/03/2023 09:00", "dd/mm/yyyy hh:mm"), "EndDate", FORMAT("17/03/2023 17:00", "dd/mm/yyyy hh:mm") ),
    ROW ( "StartDate", FORMAT("16/03/2023 09:00", "dd/mm/yyyy hh:mm"), "EndDate", FORMAT("20/03/2023 17:00", "dd/mm/yyyy hh:mm") ),
    ROW ( "StartDate", FORMAT("16/03/2023 09:00", "dd/mm/yyyy hh:mm"), "EndDate", FORMAT("20/03/2023 12:30", "dd/mm/yyyy hh:mm") ),
    ROW ( "StartDate", FORMAT("16/03/2023 14:30", "dd/mm/yyyy hh:mm"), "EndDate", FORMAT("20/03/2023 12:30", "dd/mm/yyyy hh:mm") ),
    ROW ( "StartDate", FORMAT("17/03/2023 14:30", "dd/mm/yyyy hh:mm"), "EndDate", FORMAT("20/03/2023 12:30", "dd/mm/yyyy hh:mm") ),
    ROW ( "StartDate", FORMAT("16/03/2023 09:00", "dd/mm/yyyy hh:mm"), "EndDate", FORMAT("27/03/2023 17:00", "dd/mm/yyyy hh:mm") ),
    ROW ( "StartDate", FORMAT("02/03/2023 09:00", "dd/mm/yyyy hh:mm"), "EndDate", FORMAT("27/03/2023 17:00", "dd/mm/yyyy hh:mm") )
)
Dangar332
Super User
Super User

Hi, @MarkH 

use column tools 

in column tools choose format option and select    dd/mm/yyyy  or as you want 

 

Dangar332_0-1703074526285.png

 

I had tried that & unfortunately it doesn't work.

wierd 😫

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.