Forum Discussion
Dates showing as year: 1899
- 5 years ago
This is what I see. StartMonth is a text datatype (it should be a datetime). It contains 5 possible values (in the visible data) , one of which is blank.
The code in the added column is looking for text values of December, January etc which it will never find. The code always falls through to the "else" clause which is 0. A 0 date represents 1/12/1899.
----------------------
It looks like you want to get the 1st of the month for a non-blank date and put that in a new column. That's straightforward to do.
In Power Query, select the StartMonth column. Change the datatype to Datetime.
Go to the Add Column menu.
From the ribbon, select Date->Month->start of month.
That will get the 1st of the month and put null in for empty dates.
How does that sound?
Please show us the code for the conditional column and some sample data please
that data is confidential, the data pulls from a sharepoint page
- HotChilli5 years ago
Community Champion
How can anyone debug if we can't see the StartMonth column?
- Sunnie5 years ago
Helper I
sorry, does this help?
- HotChilli5 years ago
Community Champion
This is what I see. StartMonth is a text datatype (it should be a datetime). It contains 5 possible values (in the visible data) , one of which is blank.
The code in the added column is looking for text values of December, January etc which it will never find. The code always falls through to the "else" clause which is 0. A 0 date represents 1/12/1899.
----------------------
It looks like you want to get the 1st of the month for a non-blank date and put that in a new column. That's straightforward to do.
In Power Query, select the StartMonth column. Change the datatype to Datetime.
Go to the Add Column menu.
From the ribbon, select Date->Month->start of month.
That will get the 1st of the month and put null in for empty dates.
How does that sound?