Is there any way to shorten this formula?
Couple options:
If your {Month}
field is getting its value from a date field, you could just use DATETIME_FORMAT()
, which has a predefined format for getting the quarter. Do 'Q' & DATETIME_FORMAT({Date field}, 'Q')
.
Or you could stick to using SWITCH()
and just add a little math:
SWITCH(INT(Month / 4), 0, 'Q1', 1, 'Q2', 2, 'Q3', 3, 'Q4')
Couple options:
If your {Month}
field is getting its value from a date field, you could just use DATETIME_FORMAT()
, which has a predefined format for getting the quarter. Do 'Q' & DATETIME_FORMAT({Date field}, 'Q')
.
Or you could stick to using SWITCH()
and just add a little math:
SWITCH(INT(Month / 4), 0, 'Q1', 1, 'Q2', 2, 'Q3', 3, 'Q4')
Awesome Kamille
INT(Month / 4) is what I was looking for but DATETIME_FORMAT({Date field}, βQβ) is even better for me :winking_face:
Thank U
Couple options:
If your {Month}
field is getting its value from a date field, you could just use DATETIME_FORMAT()
, which has a predefined format for getting the quarter. Do 'Q' & DATETIME_FORMAT({Date field}, 'Q')
.
Or you could stick to using SWITCH()
and just add a little math:
SWITCH(INT(Month / 4), 0, 'Q1', 1, 'Q2', 2, 'Q3', 3, 'Q4')
There some issues with the INT methods due to βroundnessββ¦
But I found happiness with
CONCATENATE(βQβ, DATETIME_FORMAT(Date, βQβ))
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.