How to concatenate year and month in tableau 8.0.0?

Gautam Seshadri picture Gautam Seshadri · Aug 22, 2013 · Viewed 21.8k times · Source

I have a datetime field .for e.g. 2013-08-22 12:00:00 AM. I want to concatenate the year and month and i want the output as 201308.

When i try year (datetime_field)+month(datetime_field) what i get get is 2013+08=2021 .. i.e it adds instead of conactenating. Can someone pl tell how to get the output as 201308?

Answer

Hellion picture Hellion · Aug 22, 2013

something more like

str(year(datetime_field)) + str(month(datetime_field))

should give you what you want.

the str function converts your numeric data to a string, setting up the + to be a string-concatenation operation instead of an arithmetic-addition operation.