Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Using two conditionals in expression

Hello

I use QV as a final user so I am not skilled in programming and how QV works, special in Set Analysis

I need to get the subtract of two dates: Date Received - Purchase Date in order to calculate the Days Passed.  If the Date Received is blank, the operation must be the Actual Date (Today) - Purchase Date.

Thank you very much

two conditionals.JPG

7 Replies
Anonymous
Not applicable
Author

if(isNull([Date Received]), Today() - [Purchase Date], [Date Received] - [Purchase Date])

Vegar
MVP
MVP

You could user the alt() function like this:

Alt([Date Received], Today()) - [Purchase Date]

Anil_Babu_Samineni

Try this too

If(Interval([Date Received]-[Purchase Date],'d') > '0', Date(Interval([Date Received]-[Purchase Date]),'DD/MM/YYYY'), Date(Interval(Today()-[Purchase Date]),'DD/MM/YYYY'))


OR


If([Date Received] = ' ', Date(Interval(Today()-[Purchase Date]),'DD/MM/YYYY'), Date(Interval([Date Received]-[Purchase Date]),'DD/MM/YYYY'))

Please add me Anil_Babu_Samineni to interact faster when reply back. Speak low think High.

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
Anonymous
Not applicable
Author

Thank you Anil Babu.

The result of your expression is a date format 'DD/MM/YYYY' and I need it in day numbers.

The expressions provided by Marcio Arruda and Vegar Lie Arntsen are working the way I need

Thanks to all of you

Vegar
MVP
MVP

I'm pleased that you found an answer to your question.

When applicable please mark the appropriate replies as CORRECT. This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution. Please mark threads as HELPFUL if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads as HELPFUL if you feel additional info is useful to others.

/Vegar

Anil_Babu_Samineni

You can use networkdays  with two date fields.  And you want  to calculate  all  days  right  if so use

Networkdays(date1, date2)

Please add me Anil_Babu_Samineni to interact faster when reply back. Speak low think High.

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
Anonymous
Not applicable
Author

Thank you so much.