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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
saivina2920
Creator
Creator

How to calculate from date if i enter user input as number

I have the date field along with user input.

For Example,

I have date, 20/09/2018

User Input = 10 ==> 10 means 10 days.

Final Date is = 30/09/2018 (plus 10 days added).

How to set the expression in qlikview.

Labels (1)
19 Replies
tresesco
MVP
MVP

In qlik integer 1 means 1 day. So you can try like:

=date(yourDate+10)            // this will give you a date after 10 days

saivina2920
Creator
Creator
Author

I used the below expression. but, getting error

=date(EMPJOINDATE+$(vUserInput)) ==> Error

tresesco
MVP
MVP

Select a date from your date field. Do you get an output?

saivina2920
Creator
Creator
Author

Error: Error in expression: ')' expected

below is the expression.

=date(EMP_RESIGN_DATE+$(vUserInput))

tresesco
MVP
MVP

Your date might not be treated as a number but text. In listbox, are these date values left aligned by default? Could you share a sample or screenshot ?

saivina2920
Creator
Creator
Author

Thanks for your reply.

I am trying to get some logic for my requirement. I already posted my logic and requirement.

How to calculate blank value along with add new column date and user Input 

till now i didn't get proper output.

can you give us the idea and how to form the output.

Requirement is below.

1. When user will not entered anything in input, then output table coming as correct.

2. When user entered input, then it is difficult to get the output

   

pls. check the latest attachment with this.

As per Attached Excel sheet,

OUTPUT - 1 (Highlighted Green)  : When user will not be entered any input

OUTPUT - 2  (Highlighted Yellow) : User Enter Input. So, EMP_RELIEVE_DATE = corresponding blank       

                                                                       of EMP_RELIEVE_DATE ROW.

                                                                       It means, EMP_RESIGN_DATE (14/08/2020 + 10 = 24/08/2020         

                                                                            ==> EMP_RELIEVE_DATE...

                           Like that all the blank rows should calculate if User Enters Input.

 

tresesco
MVP
MVP

Now, it's a bigger box. 😋

How is your resignation date changing in excel for second table? Can I avoid that? If so, I just used calculated dimension for relieving date like:

=Date(EMP_RELIEVE_DATE+vUserInput) .. and it worked for me.

saivina2920
Creator
Creator
Author

Yes. It's bigger box. But, i am in a position to complete this task asap.

How is your resignation date changing in excel for second table?

    Ans : resignation date changing based on emp_relieve_date should be blank  + user input.

 

tresesco
MVP
MVP

Try like:

Emp reg date (Calculated dim):

=If(vUserInput, if(IsNull(EMP_RELIEVE_DATE), EMP_RESIGN_DATE), if(not IsNull(EMP_RELIEVE_DATE), EMP_RESIGN_DATE))

Exp1 ("Relieving Date"):

=If(vUserInput, if(IsNull(EMP_RELIEVE_DATE), Date(EMP_RESIGN_DATE+vUserInput)), if(not IsNull(EMP_RELIEVE_DATE), EMP_RELIEVE_DATE))

Exp 2 : (1-10days)

If([Relieving Date]>=Today()-10, 1,0)           // 'Relieving Date' is label to previous exp.