
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
subtract 120 days from date
Hello.
I have a problem, I need to subtract 120 days to a date and I can not.
Subtraction is a field that is not master calendar, I use a MAKEDATE (year, month, day) to create the date, but everything I use does not give correct results.
Anyone have any idea?
Thanks and regards
- Tags:
- new_to_qlikview

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
All you have to do is just say Date - 120.
Look what output it gives, if its number then you can try this. Date(Date - 120).
What are the things you have tried?
Regards,
Kaushik Solanki

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi there,
Why not use INTERVAL to subtract 120 days from your date?
For example:
Front end
date(interval([YOUR DATE] - 120,'D'),'YYYY/MM/DD')
Script
date(interval([YOUR DATE] - 120,'D'),'YYYY/MM/DD') as "NEW DATE"
Hope this helps,
Regards GJ

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Please Try this.......
=Date(makedate(2012,01,27)-120)
Thanks & Regards,
Parag Patil

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you all for your responses.
My first question is not complete, I had an error.
I need to calculate the amount of the selected date minus 120 days. I can not make it work with any of your suggestions
Attached qvw.
thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Gabriel,
If you haven't figured it out already here's a solution that works well for me
Assume you create a date like so:
LET zcurrDate = Date(MakeDate(Year(Today()), Month(Today()), Day(Today()))), 'YYYYMMDD'); //Result in this case is 20121002
to calculate a date going back n days
LET zPrevdate = Date(Date#($(zcurrDate), 'YYYYMMDD')-n, 'YYYYMMDD'); //where n=120
Lets break the above down (inside to out):
Date#($(zcurrDate), 'YYYYMMDD')-120 //Result after subtracting 120 days from 20121002 is 41064
takes string input so your date would essentially be in "string format" already, from what i see in terms of your data source in your QVW, but returns the date
in a "proper"date format that Qlikview can correctly manipulate, so subtracting 120 from the date will return a date in a number format i.e 41064 in this case
Putting the above Date# result into the "regular" Date function will convert the date as a number into a readable format i.e Date(41064) = 20120604
Works everytime for me, hope it does for you too and I hope my explanation (according to how I understand it) makes sense.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks, this just helped me workout some of my solutions, but i have a question, how can I display
Start date is = Today()?
Start date = 2012/11/02
Thanks in advance
Edzi

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
Try this
sum({<datefield={"=$(=date(today()-30))"}>}amount)


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Use Date(Num(MAKEDATE (year, month, day) )-120) then you will get the date before 120 days.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
=date(today()-1
