I'm trying to assign values for Month, Quarter and Week for given date in my view field. I'm getting an error as "Expected type integer, found date". Not sure what is causing this issue. Please see the attached screenshot for reference.
here is my calculation:
IF [view] = 'month' THEN DATEPART('month', [Submitteddatetime])
ELSEIF [view] = 'Quarter' THEN DATEPART('quarter', [Submitteddatetime])
ELSEIF [view] ='Week' then date( datetrunc('week',[Submitteddatetime]))
END
Any suggestions here?
@Yuri Fal if I wanted output something like this like the field having all quarter month and year values in it:
but if I use datetrunc I'm getting output similar to my submitteddate field:
So I don't want a field with year quarter month drill down, instead I'm looking to have a field with all quarter, weekly and monthly values in it(just like a dimension)