Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Convert date field to Q1 Q2...

Hello,

First, thank you for your assistance in helping me with the below issue.

I used the script below in the Expression field to get the quarter name

QuarterName([Date Rqstd])

6-9-2016 4-02-47 PM.jpg

Then to get Q1, Q2, Q3, Q4. I changed the above script to the one below.

'Q' & Ceil(Month([Date Rqstd])/3)

6-9-2016 4-06-35 PM.jpg

But as you can see there is an extra value "Q".  I checked the field data and there are no nulls.  how do I get it to just show Q1, Q2, Q3, Q4 in the listbox? Again, thank you for your help!

18 Replies
Not applicable
Author

Hi,

try this,

'Q' & Ceil(month(Date([Date Rqstd]))/3)

Not applicable
Author

it woks without including (as Quarter)

Not applicable
Author

it works without including (as Quarter)

pho3nix90
Creator II
Creator II

I would suggest to add a where clause to your calendar.

Where Len (Trim([Date Rqstd]))>0

sunny_talwar

Where exactly are you using this my friend? Where clause?

Not applicable
Author

hi,

In the listbox itself - instead of using the field. I use an expression.

Not applicable
Author

here is the script:

LOAD [Assigned To],
[Bus. or Dept.],
Leaders,
Comments________________________________,
[T-Shirt Sz],
[Actual Compl. Date],
[Applic. Category],
[Request Title (Linked to SR Doc.)],
[Request Description],
[Demand Type],
Status,
[Rqstd. Compl.],
Created,
Domain,
[Est. Compl. Date],
[Finance Relevant],
ID,
[IS&T Group],
Request#,
[Date Rqstd],
MakeDate(year([Date Rqstd])) as [Year Requested],
[Primary Contact],
Priority,
[BPOC Relevant],
Requestor__,
Site,
[Yr Compl. a/o Closed],
ListID,
%Key_xml_98C49F546A18E856
FROM
[Service.qvd]
(
qvd)
WHERE
MakeDate(year([Date Rqstd])) >= '1/1/2014' and IsNull([Date Rqstd])=0;

Not applicable
Author

here is the script:

LOAD [Assigned To],
[Bus. or Dept.],
Leaders,
Comments________________________________,
[T-Shirt Sz],
[Actual Compl. Date],
[Applic. Category],
[Request Title (Linked to SR Doc.)],
[Request Description],
[Demand Type],
Status,
[Rqstd. Compl.],
Created,
Domain,
[Est. Compl. Date],
[Finance Relevant],
ID,
[IS&T Group],
Request#,
[Date Rqstd],
MakeDate(year([Date Rqstd])) as [Year Requested],
[Primary Contact],
Priority,
[BPOC Relevant],
Requestor__,
Site,
[Yr Compl. a/o Closed],
ListID,
%Key_xml_98C49F546A18E856
FROM
[Service.qvd]
(
qvd)
WHERE
MakeDate(year([Date Rqstd])) >= '1/1/2014' and IsNull([Date Rqstd])=0;

sunny_talwar

Try this:

LOAD [Assigned To],
[Bus. or Dept.],
Leaders,
Comments________________________________,
[T-Shirt Sz],
[Actual Compl. Date],
[Applic. Category],
[Request Title (Linked to SR Doc.)],
[Request Description],
[Demand Type],
Status,
[Rqstd. Compl.],
Created,
Domain,
[Est. Compl. Date],
[Finance Relevant],
ID,
[IS&T Group],
Request#,
[Date Rqstd],

'Q' & Ceil(Month([Date Rqstd])/3) as Quarter,
MakeDate(year([Date Rqstd])) as [Year Requested],
[Primary Contact],
Priority,
[BPOC Relevant],
Requestor__,
Site,
[Yr Compl. a/o Closed],
ListID,
%Key_xml_98C49F546A18E856
FROM [Service.qvd] (qvd)
WHERE Year([Date Rqstd]) >= 2014 and Len(Trim([Date Rqstd])) > 0;

and now your Quarter field should most likely not have any Q's