Forum Discussion
shri0025
Helper II
5 years agoHow To create Date Column From Month and Year column 2018-19 in Power Query
Hi I am New in Power BI Please help to me How To create Date Column From Month and Year column 2018-19 in Power Query . Business Year Month Quarter Division Qty State Branch A 2018-1...
BA_Pete
Super User
5 years agoHi shri0025 ,
Try this new column:
Date.From(
Text.Combine(
{
"01",
[Month],
if
(not List.Contains({"Jan", "Feb", "Mar"}, [Month])
and Date.Month(DateTime.LocalNow()) >= 4)
or
(List.Contains({"Jan", "Feb", "Mar"}, [Month])
and Date.Month(DateTime.LocalNow()) < 4)
then
Text.From(Date.Year(DateTime.LocalNow()))
else if
not List.Contains({"Jan", "Feb", "Mar"}, [Month])
and Date.Month(DateTime.LocalNow()) < 4
then
Text.From(Date.Year(DateTime.LocalNow()) - 1)
else
Text.From(Date.Year(DateTime.LocalNow()) + 1)
}, "-"
)
)
I've tried to make this as dynamic as possible, so the date years will increase by 1 on 1st April each year, on the assumption that this table only ever holds current FY data.
I get the following output:
Pete
shri0025
Helper II
5 years agoHi Thank you very much