Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
M
You can do this in your calendar script
[MasterCalendar]:
LOAD Date,
If(Month(Date) <= 6, 1, 2) as HalfYear,
...
Resident xyz;
Can you explain what the 6,1,2 means?
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
Yes makes sense but then my results are showing a value of 1 when I was expecting 6 for the shown dates?
Why are you expecting to see 6? I might have mis-understood your problem. Can you reexplain please?
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.
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.
See if you can adapt the same trick from below:
OP's requirement is to split the year into quarters, solution was ApplyMap()
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
];