if [ZPOST_DATE]>= TODAY() then DATETRUNC('month',[ZPOST_DATE]) else [ZPOST_DATE] END
Datetrunc is a cool function that truncates the date field to the beginning of the time period you specify. (If you had specified 'year' it would make the date 1/1/2017, for example.)
Just something to consider. If that date is some date in March and you did the datetrunc, it would make it March 1, even if you run it in January or February. So if you have to deal with that situation, it's not as simple as just using datetrunc.
And if you want to make a specific date value, often MAKEDATE is the function to use.
MAKEDATE(YYYY, MM, DD)
So MAKEDATE( YEAR(TODAY()), MONTH(TODAY()), 1) would create a data that is the first of the current month.
I tried this and it appeared to be working but now I am trying to go a little further and make ANY date that has null in one field and make it the beginning of the month.
Here is the formula I created:
DATE(if isnull([ZINVOICEDATE]) then DATETRUNC('month',[ZPOST_DATE]) else [ZPOST_DATE] END)
Where [ZINVOICEDATE] is null when [ZPOST_DATE] is the end of the month. For some reason this isn't working properly. Here is some data and I'm not sure why it is not. Any ideas?
Hard to say what's going wrong there. You just say "isn't working properly"...
At this point I don't want to guess. Post your tableau version and a packaged workbook. ( If you need to anonymize stuff, check out this video: Anonymize your Tableau Package Data for Sharing )