Im trying to perform a transformation of a coludate in QS
here is the code for calculated field
concat(
toString(
extract(
'YYYY',
{created_at}
)
),
toString(
ifelse(
extract(
'MM',
{created_at}
)<10,
concat(
'0',
toString(
extract(
'MM',
{created_at}
)
)
),
extract(
'MM',
{created_at}
)
)
)
)
)
it works if I dont use the conditional, but I need it to add a 0 when is one of the first nine months of the year.
When I try to run it, it states that the sintaxis it’s wrong and I should pick the option create, but I’m not sure what it means.
2
Answers
I ended up using this
left(toString({created_at}), 7)
Which left the date like yyyy-mm but works.
Are you really planning to use such a complex expression?
Why not:
?