Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Read about Qlik’s Response to COVID-19 Read the Letter, Join the Group.
Highlighted
Contributor

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
Contributor III

Re: Using two conditionals in expression

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

Highlighted
Partner
Partner

Re: Using two conditionals in expression

You could user the alt() function like this:

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

Plees ekskuse my Swenglish and or Norweglish spelling misstakes
Highlighted

Re: Using two conditionals in expression

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'))

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)
Highlighted
Contributor

Re: Using two conditionals in expression

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

Highlighted
Partner
Partner

Re: Using two conditionals in expression

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

Plees ekskuse my Swenglish and or Norweglish spelling misstakes
Highlighted

Re: Using two conditionals in expression

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

Networkdays(date1, date2)

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)
Highlighted
Contributor

Re: Using two conditionals in expression

Thank you so much.