Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
qlikmpate0
Creator II
Creator II

Seperate dates into Jan-Jun and Jul-Dec

I'm trying to separate requisitions using the creation_date into two intervals, first half of the year and the second half.

I'm getting abit muddled can someone help.

I'm thinking of using flags to determine whether the date falls in the first half or second half of the year, but my coding skills are not very good.

thanks in advance

regards

9 Replies
sunny_talwar

You can do this in your calendar script

[MasterCalendar]:

LOAD Date,

          If(Month(Date) <= 6, 1, 2) as HalfYear,

          ...

Resident xyz;

qlikmpate0
Creator II
Creator II
Author

Can you explain what the 6,1,2 means?

sunny_talwar

Month(Date) will give you Jan, Feb, Mar and so on... which is also a dual field meaning that Jan = 1, Feb = 2, Mar = 3 and so on. So when Month(Date) <= 6, it falls under the bucket of Jan, Feb, Mar, Apr, May, Jun which is the 1st half year (1) and the rest of the months are other half (2)

Does that make sense?

Best,

Sunny

qlikmpate0
Creator II
Creator II
Author

Yes makes sense but then my results are showing a value of 1 when I was expecting 6  for the shown dates?

requistions.JPG

sunny_talwar

Why are you expecting to see 6? I might have mis-understood your problem. Can you reexplain please?

qlikmpate0
Creator II
Creator II
Author

becuase my req date is in the month Jun and the half year value would be 6 if Jun, 1 if Jan 3 if Mar yes?

What I'm strying to do is separate all the requistion dates into two seperate buckets so I can have a selector one for jan-Jun and the other Jul-Dec.

Apologies if I haven't made myself clear.

sunny_talwar

What is your date format?  DD/MM/YYYY or MM/DD/YYYY? because if its DD/MM/YYYY all your dates fall in 1st half of the year and is displaying the 1 for half year correctly.

HalfYear should be 2 buckets 1 and 2, 1 will include Jan-Jun and 2 will include Jul-Dec.

jpenuliar
Partner - Specialist III
Partner - Specialist III

See if you can adapt the same trick from below:

Apply Map

OP's requirement is to split the year into quarters, solution was ApplyMap()

jpenuliar
Partner - Specialist III
Partner - Specialist III

excerpt:

replace your month names with numbers in your mapping table:

Month_Quarter_Mapping:

Mapping Load * Inline

[

1,Q1

2,Q1

3,Q1

4,Q1

5,Q1

6,Q2

];