Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
I have my date column as MMM-YY(Example: JUN-19) in csv file. I want to take it as DD-MM-YYYY(Example: 01-06-2019) format in Power BI.
The date is taken as text column when imported. When I convert the datatype to Date, it takes the YY-DD-CurrentYYYY(Example: 19-06-2021) format which is incorrect.
In CSV | When DT changed to Date in PBI | Expected Output |
Jun-19 | 19-06-2021 | 01-06-2021 |
Jul-19 | 19-07-2021 | 01-07-2021 |
Aug-19 | 19-08-2021 | 01-08-2021 |
Sep-19 | 19-09-2021 | 01-09-2021 |
Image Representation of requirement:
Note: Changing the format to long date in CSV file is resolving issue but I do not want to change things at CSV file end since it will be a manual effort every time.
Solved! Go to Solution.
Hi @atult ,
You can create another column and use the next code:
1. Add Column - Custom Column
2. Type = Date.From("01-" & [In CSV])
= Table.AddColumn(Source, "Custom", each Date.From("01-" & [In CSV]))
If this post helps, then please consider Accept it as the solution ✔️to help the other members find it more quickly.
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your Kudos.
Check out my latest demo report in the data story gallery.
Stand with Ukraine!
Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/
Thank you!
Hi @atult ,
You can create another column and use the next code:
1. Add Column - Custom Column
2. Type = Date.From("01-" & [In CSV])
= Table.AddColumn(Source, "Custom", each Date.From("01-" & [In CSV]))
If this post helps, then please consider Accept it as the solution ✔️to help the other members find it more quickly.
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your Kudos.
Check out my latest demo report in the data story gallery.
Stand with Ukraine!
Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/
Thank you!
Hey @atult ,
usually the DATE.FROM function in Power Query should be able to handle that.
Check the following query:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8irN0zW0VNJRMrTUNTDTNTIwMgRyDAzhnFgdkKIchCJzZEXmCEWOpekIRRbIiiwQioJTCxCKLJEVQTmxsQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"n CSV" = _t, #"When DT changed to Date in PBI" = _t, #"Expected Output" = _t]),
#"Inserted Date" = Table.AddColumn(Source, "Date", each Date.From([n CSV]), type date)
in
#"Inserted Date"
Let me know if that works for you.
Hi @selimovd ,
This is not working.
As I said, when the Date(MMM-YY) is converted to date datatype, it is giving me incorrect date as I shown in the table in my initial query.
Hence, even with DATE.FROM function, I'm getting "19-06-2021" instead of "01-06-2021" for "JUN-19".
Hi @atult
Can you try using the format option available in the data view and change to desired format by typing it in the date format drop down list.
Thanks
User | Count |
---|---|
94 | |
83 | |
78 | |
75 | |
66 |
User | Count |
---|---|
115 | |
105 | |
93 | |
65 | |
62 |