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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Add days to a month

How can I split a month into half ( first half, second half) . I was actually looking for an expression, where I can split my metrics into tiers based on the following criteria 

1)  usage date <= activation month + 15 days.

2) usage date > activation month + 15 days and usage date <= activation month + 45 days

3) usage data > activation month + 45 days and usage date <= activation month + 75 days

5 Replies
tyagishaila
Specialist
Specialist

Do you have month field or Date field.

Not applicable
Author

Hi Tyagishaila,

I have date filed for usage and month field for activations.

sunny_talwar

May be like this:

LOAD [usage date],

    [activation month],

   If([usage date] - [activation month] <= 15, Dual('Tier 1', 1),

    If([usage date] - [activation month] <= 45, Dual('Tier 2', 2),

    If([usage date] - [activation month] <= 75, Dual('Tier 3', 3)))) as Tiers

tyagishaila
Specialist
Specialist

Have you get solution in Sunny T's reply ?

kkkumar82
Specialist III
Specialist III

If you want to have a date flag showing first half and second half create a flag in the edit script as

if(Day(Date)<= 15,'First Half','Second Half') as DaysFlag

Also keep in minds months with 30,31,28,29 days in the if condition