Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
rathnam_qv
Creator
Creator

Creating day Numbers

Hi All,

I want to assign numbers to each quarter..Like for Q1, 1 to 100 and for 2nd quarter again it should start from 1 to 91...

     same for Q3 and Q4.

Can someone suggest me.

Thanks in advance!

Muni.

9 Replies
Arthur_Fong
Partner - Specialist III
Partner - Specialist III

Hi Muni,

Can you please provide the full requirement?

Why is Q1 starting from 1-100 but Q2 is 1-91?

What about Q3 and Q4? is it 1-100 or 1-91?

marcus_sommer

Try it with: daynumberofquarter().

- Marcus

rathnam_qv
Creator
Creator
Author

HI Marcus,

Thank you for your suggestion.

I want to achieve the below .

date       expected_value
2017-01-01        1         # because it it the first day in Q1
2017-01-02        2         # because it is the second day in Q1
2017-02-01        32        # because it is the 32th day in Q1
2017-04-01        1         # because it is the first day in Q2


Thanks,

Muni.

marcus_sommer

Did you try: daynumberofquarter(date) ?

- Marcus

rathnam_qv
Creator
Creator
Author

Thanks Marcus,

It is working fine.

rathnam_qv
Creator
Creator
Author

Hi Marcus,

How can i get same DayofQuarternumber of previous quarter.

Example: 2018Q3 ,9/5/2018, 67Day, value

                2018Q2, 6/5/2018, 67Day, value (need to get this dynamically)

Please suggest me.

Thanks,

Muni.

marcus_sommer

I think it's not possible - then months have just a different number of days and therefore the quarter-number couldn't return the same calendar-day in another quarters. I think you need a different approach for it - maybe with addmonths() like:

addmonths(date, -3)

- Marcus

rathnam_qv
Creator
Creator
Author

Hi Marcus,

I tried this "addmonths(date, -3)" but it will not give the same DaynumberofQuarter.


Muni.

marcus_sommer

My suggestion with addmonths() wasn't aimed to get the same quarter-number (like above mentioned I think it's not possible) else to return the same calendar-date (day-number) within the months.

I don't know what your aim is with the quarter-number but a comparing of any measure against them or a monthly calendar-day will always have some blurring. An alternatively (which also not mandatory give you the same calendar-day back) might be to count working-days within your periods (excluding weekends or any kind of holidays).

If everything of it is not really satisfying for you you could consider to use another calendar like 4-5-4 Master Calendar whereby I'm not sure that any of the alternative calendars might fit to your requirements and/or have other disadvantages.

- Marcus