Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

issue with quarter function,need help please!

hi all,

I have given the below expression to obtain quarter field  and  from date field called Month.but I get the below result as

'Quarter' & ceil(month(Month)/3) as Quarter ,

quarter
Quarter
Quarter1
Quarter2
Quarter3
Quarter4

Here I do not want the value Quarter how do I modify this to get the below result

quarter
Quarter1
Quarter2
Quarter3
Quarter4

please can someone help me out to resolve this??

sahana

8 Replies
ecolomer
Master II
Master II

Hi,

Check list values of Month, I thiks there are an "blank" or similar

For that you can create a table with:

Month Q

where Month is your values and Q is ceil(month(Month)/3)

Not applicable
Author

Hi Enrique,

I checked,there are no blanks,null etc in the list of month in the excel sheet.How do I proceed,please guide.

Sahana

ecolomer
Master II
Master II

I think you should have rows in your excel worthless.

do the following, stand in the next row to the last valid value and delete all lines to the end

Not applicable
Author

hi,

its actually taking the data directly from database.Is there a way to restrict the blanks in the script level while using this function??

sahana

jagan
Luminary Alumni
Luminary Alumni

Hi,

I think for some records the Months are missing that is why you are getting just Quarter, if you want to remove those then try like this

LOAD

*,

If(Len(Trim(Month)) > 0, 'Quarter' & ceil(month(Month)/3)) as Quarter

FROM DataSource;

The above script assigns null to Quarter which is having no month value.

Hope this helps you.

Regards,

Jagan.

ecolomer
Master II
Master II

if(Month>0, 'Quarter' & ceil(month(Month)/3, Null()) as Quarter

Not applicable
Author

thanku all I learnt something new.

jagan
Luminary Alumni
Luminary Alumni

Hi,

Please close this thread.

Regards,

jagan.