Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
evansabres
Specialist
Specialist

Date Subtraction

I have two fields 'Event Date' and a variable vOnSaleDate.

What I want to do is find the amount of time remaining (in a percentage) until an 'Event Date' relative to the vOnSaleDate and today's date. c

I have no idea how to structure this correctly, however this is how I envision the expression functioning.

=(([Event Date] - Today's Date)/([Event Date] -(vOnSaleDate))

Ultimately, if vOnSaleDate = '9/16/2017', the 'Event Date' is 10/5/17' and today's date is 09/20/2017, I want to end up with 83%, indicating that there is 83% of time remaining until the event date relative to the on-sale date.

1 Solution

Accepted Solutions
sunny_talwar

Or this

=([Event Date] - Today())/([Event Date] - vOnSaleDate)

View solution in original post

5 Replies
sunny_talwar

May be this

=([Event Date] - Today())/([Event Date] - $(vOnSaleDate))

sunny_talwar

Or this

=([Event Date] - Today())/([Event Date] - vOnSaleDate)

evansabres
Specialist
Specialist
Author

This is what I have in my original question, that should work?

sunny_talwar

I think so... beside you had Today's Date and I replaced it with Today()... and then there were some extra parenthesis that i got rid of ... So, in your current state your expression would probably have not worked.... but yes, in general your expression should work

its_anandrjs

Try this

= ( ( ( [Event Date] - Today() ) / ( [Event Date] - (vOnSaleDate) ) ) * 100


Or


= ( ( ( [Event Date] - Today() ) / ( [Event Date] - $(vOnSaleDate) ) ) * 100