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

Announcements
Posting on Qlik Community is temporarily paused. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
manu1512
Creator
Creator

Rolling Six Months

Hi all,

 

I have date in format sales date :- 'YYYY-MM'

Now i want to create six months flag..can you please tell me logic.

 

 

 

Kind Regards

Manu

Labels (1)
1 Solution

Accepted Solutions
JordyWegman
Partner - Master
Partner - Master

Hi Manu,

Then you can do this in the set analysis:

Sum({$< Date = {">=$(=AddMonths(Date,-6) <=$(Date)"}>} Sales)

Jordy

Climber

Work smarter, not harder

View solution in original post

4 Replies
Sameer9585
Creator II
Creator II

try this?

sum({<Date={$(='>=' & Date(YearStart(addMonths(Date,-5))),'YYYY-MM') & '<=' & Max(Month(Date))}>}sales)
JordyWegman
Partner - Master
Partner - Master

Hi Manu,

Do you mean an indicator that tells you what the last six months are in your calendar?

Then you can do the following:

IF(Date(Addmonths(Today(),-6),'YYYY-MM') >= SalesDate,1,0) as _indRLSM // RollingLastSixMonths

You can use this in set analysis like: Sum({$< _indRLSM = {1}>}Sales)

Jordy

Climber

Work smarter, not harder
manu1512
Creator
Creator
Author

Hi Jordy,

 

Unfortunately i have no calendar in my model,i have only this field in actual table,

 

will it work there ?? in table

JordyWegman
Partner - Master
Partner - Master

Hi Manu,

Then you can do this in the set analysis:

Sum({$< Date = {">=$(=AddMonths(Date,-6) <=$(Date)"}>} Sales)

Jordy

Climber

Work smarter, not harder