Skip to main content

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?Calculation error when using date functions with the if statement.

8 respostas
  1. 7 de mar. de 2024, 15:01

    @Yuri Fal​  if I wanted output something like this like the field having all quarter month and year values in it:@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 wbut if I use datetrunc I'm getting output similar to my submitteddate field:imageSo 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)

0/9000