Forum Discussion
Fiscal year in format 2023-24 for example
I get an error
"Expression.Error: The name 'If' wasnt recognised. Make sure it is spelled correctly.
I changed it to
= Table.AddColumn(#"Changed Type", "Custom", each if (Date.Month([Date]) <=3 , Number.ToText(Date.Year([Date])) & "-" & Text.End(Number.ToText(Date.Year([Date])+1),2)) , Number.ToText(Date.Year([Date])+1) & "-" & Text.End(Number.ToText(Date.Year([Date])+2),2)
and now it says Expression.SyntaxError: Token ')' expected.
But I can't figure out where that ) would go
- Anonymous2 years agoNot applicable
Hi Lizzieleman ,
In the code you provided:
There are 13 "(" and only 12 ")". You need to add a ")" at the end of the code.
And remember to accept amitchandak 's answer as a solution.
Best Regards,
Dino Tao- Lizzieleman2 years agoFrequent Visitor
Yes I tried this it still has the same error
Code now reads like this:
if( Date.Month([Date]) <=3 , Number.ToText(Date.Year([Date])) & "-" & Text.End(Number.ToText(Date.Year([Date])+1),2) , Number.ToText(Date.Year([Date])+1) & "-" & Text.End(Number.ToText(Date.Year([Date])+2),2)))
But doesn't work
- Lizzieleman2 years agoFrequent Visitor
I've figured out the brackets but now I get another error
"Token 'then' expected, could someone help me figure this out?
if (Date.Month([Date])) <=3 , number.ToText(Date.Year([Date])) & "-" & Text.End(Number.ToText(Date.Year([Date])+1),2)) , Number.ToText(Date.Year([Date])+1) & "-" & Text.End(Number.ToText(Date.Year([Date])+2),2))