Skip to main content

Hi all,

 

I am trying to generate quarter values such as "Q1 2020', 'Q2 2020' etc.

 

I used this calculation here but i am getting an error that says that 'can't compare datetime and float values'. I tried wrapping the date with float but no values were being generated.

 

Please see the expressions i used

 

IF [End Processing] >= 1/1/2020 and [End Processing] <= 3/31/2020

THEN 'Q1 2020'

ELSEIF 

[End Processing] >= 4/1/2020 and [End Processing] <= 6/30/2020

THEN 'Q2 2020'

ELSEIF 

[End Processing] >= 7/1/2020 and [End Processing] <= 9/30/2020

THEN 'Q3 2020'

ELSEIF 

[End Processing] >= 10/1/2020 and [End Processing] <= 12/31/2020

THEN 'Q4 2020'

ELSEIF  

[End Processing] >= 1/1/2021 and [End Processing] <= 3/31/2021

THEN 'Q1 2021'

END

2 answers
  1. Jun 5, 2021, 9:05 PM

    Put # around your dates.

     

    IF [End Processing] >= #1/1/2020# and [End Processing] <= #3/31/2020#

    THEN 'Q1 2020'

    ELSEIF

    [End Processing] >= #4/1/2020# and [End Processing] <= #6/30/2020#

    THEN 'Q2 2020'

    ELSEIF

    [End Processing] >= #7/1/2020# and [End Processing] <= #9/30/2020#

    THEN 'Q3 2020'

    ELSEIF

    [End Processing] >= #10/1/2020# and [End Processing] <= #12/31/2020#

    THEN 'Q4 2020'

    ELSEIF

    [End Processing] >= #1/1/2021# and [End Processing] <= #3/31/2021#

    THEN 'Q1 2021'

    END

0/9000