Forum Discussion
Power BI Text to Date conversion - Extreme newbie
- 1 year ago
The lowest form of data I have on the origial data is "2024 Q1"Add a Date column to your data, for example the first day of that quarter. Use the Date column to join to the calendar table.
Hey lovelylemon. Here's a solution you could look at for your query. I'll attach the images of the output, the input and the snippet of the code for your reference. Thanks
- lovelylemon1 year agoNew Member
Hi, this looks what I was looking for, though user incompetence is stopping me from actioning it (completly new to power query /BI) .
I can see the steps, but can you breakdown the actions so I understand it? I have tried to replicate the advanced editor but I got an error.- SundarRaj1 year ago
Super User
Sure lovelylemon
1. The first two steps basically imports the data and sets the data type.
2. List: Table.Transform Function helps me make alternations to the column I am working with which is Fiscal Quarter column in your case. What I am trying to do is basically split the text by a space into a List of 2 items i.e. 2024 and Q1. Post Splitting I am replacing any text with "Q" to a blank which aids me in havings inputs for a date.
3. Similarly, the next code simply just uses the #date function. Since we have a list of 2 items originally, to create a date, I would need a year, month and day. For the year, Number.From(_{0}), this essentially means I am extracting the first item of the list and converting it into a number and using it as a year input for #date.
4. Similar thing has been done for Month as well and day has been taken as 1 by default.
Let me know if you would need any more clarifications on any piece of code written. Thanks