I had a OLE DB data source for SSAS using query. It was returning the column names like [Time].[Reporting Period].[Fiscal Year].[Member_CAPTION]
When I tried to convert the data types using the derived column type cast – DT_WSTR(expression, size), it was returning error: cannot parse the expression. The expression was not valid.
The reason it was returning error because of the column name format [Time].[Reporting Period].[FiscalYear].[Member_CAPTION]. So I went to OLE DB data source properties–>column tab and then rename the output columns without the  and like “Fiscal Year”. After that it started working.