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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
TheBaz_57
Frequent Visitor

PBI randomly set date in Uk or US format. How to solve that.

Hi there, 

 

In PBI I have imported several *.csv using import from folder. 

Then first column is "Source.Name" which includes date of the file. 

 

Patern is: XXXXX.YYYY.MM.DD.XXXXXXX, like ABCD.2023.12.01.DEFGH.

So I have created 3 columns with MID function to extract Year, Month and Day. 

And another column to kind of concatenate the value (using &). And set the format to date. 

 

So should look like this :

Source.NameYearMonthDayDate
ABCD.2023.12.01.DEFGH2023120101 December 2023

 

But for some dates, not alsways, Powerbi set the last columns like this:

Source.NameYearMonthDayDate
QWERT.2023.12.10.ASDFG2023121012 October 2023

 

I have no idea why PBI does this. Any idea ? 

How can I solve that ?

 

Thanks all.

 

1 ACCEPTED SOLUTION
speedramps
Super User
Super User

You can change a date column to US or UK format like this 
https://support.microsoft.com/en-us/office/set-a-locale-or-region-for-data-power-query-d42b9390-1fff....

 

Altetnatively use Power BI question to get each segment YYYY/DD/MM and refomat at YYYY/MM/DD like this

https://www.youtube.com/watch?v=6kKT6QGikMM

 

Thanks for the clear description of the problem with example data. I wish everyone did that!

Remember we are unpaid volunteers, and you have got free expert help which took a lot of effort,
This solution works and does exactly what you asked.
So please quickly click the [accept as solution] and the thumbs up button to leave kudos. 

One question per ticket please. If you need to change or extend your request then please raise a new ticket.

You will get a quicker response and each volunteer solver will get the kudos they deserve. Thank you ! 

If you quote @speedramps in your next tickets then I will then receive an automatic notification, and will be delighted to help you again.

Please now click the [accept as solution] and the thumbs up button.  Thank you.

View solution in original post

2 REPLIES 2
Ahmedx
Super User
Super User

to know how to do this watch my video

https://1drv.ms/v/s!AiUZ0Ws7G26RjFFfV6RTnXCvhIie?e=wh8Eqd

[
t1 = Text.PositionOf([Source.Name],".",Occurrence.First),
t2 = Text.PositionOf([Source.Name],".",Occurrence.Last),
t3 = Splitter.SplitTextByPositions({0,t1+1,t2})([Source.Name]){1},
t4 = Date.FromText(t3, [Format = "yyyy.MM.dd", Culture = "en-US"])
][t4]

 

speedramps
Super User
Super User

You can change a date column to US or UK format like this 
https://support.microsoft.com/en-us/office/set-a-locale-or-region-for-data-power-query-d42b9390-1fff....

 

Altetnatively use Power BI question to get each segment YYYY/DD/MM and refomat at YYYY/MM/DD like this

https://www.youtube.com/watch?v=6kKT6QGikMM

 

Thanks for the clear description of the problem with example data. I wish everyone did that!

Remember we are unpaid volunteers, and you have got free expert help which took a lot of effort,
This solution works and does exactly what you asked.
So please quickly click the [accept as solution] and the thumbs up button to leave kudos. 

One question per ticket please. If you need to change or extend your request then please raise a new ticket.

You will get a quicker response and each volunteer solver will get the kudos they deserve. Thank you ! 

If you quote @speedramps in your next tickets then I will then receive an automatic notification, and will be delighted to help you again.

Please now click the [accept as solution] and the thumbs up button.  Thank you.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.