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
saivina2920
Creator
Creator
Author

Yes. The date is coming perfect in the dimension for both null and not null of EMP_RELIEVE_DATE

Also, if not null of EMP_RELIEVE_DATE then the count of 1-10, 10-30 and > 30 days coming perfect.

if null of EMP_RELIEVE_DATE then the count of 1-10 is not coming ==> count is not coming when enter input. 

it means , EMP_RELIEVE_DATE = EMP_RESIGN_DATE + userInput ==> Dimension is coming correct. but, count is not coming when enter input

How to arrive this..?

Note : last one row showing junk record unnecessary. want to remove. also future date count should not come in table at any case (Future date case already been maintained).

pls. find the attachment for reference and help us at final step to complete asap.

saivina2920
Creator
Creator
Author

Can you give us the update pls..

saivina2920
Creator
Creator
Author

this is urgent requirement. pls. reply when you are free

tresesco
MVP
MVP

You are not trying the way suggested. Please have a close look at the solution I suggested. One calc dim, rest all expressions. And the first expression label is important.

 

saivina2920
Creator
Creator
Author

Yeah. I got it. I followed the way. Output is coming perfect except few conditions.

1.  Is it possible to avoid the future date list and if all values zero (1-10,10-30,>30 days). (below screenshot for reference).

Junk Values an Future Date-31DEC2020-2.png

 

2. How to add more condition in the below expressions.

   If([Relieving Date]>=vCalDate10 And [Relieving Date]<=vToday, 1,0)

  More conditions :  [FROM]={'*MARIAM*'},[EMPSTATUS]={'Current'},[TO]="$(vPlaces)"

3. below expression working fine. but showing Error in Expressions" - How it is possible. (Below screenshot for reference)

If([Relieving Date]>=vCalDate10 And [Relieving Date]<=vToday, 1,0)

Error in Expressions-31DEC2020-1.png

tresesco
MVP
MVP

Hmmm, 😅

1. You can put additional condition in the if structure to exclude the future dates in calculated dim/expression. And supress null values (in dimension tab).

2. Again incorporate all these new conditions in if structure

3. It is because [Relieving Date] is not a field but label. If it's working let it go.😋

saivina2920
Creator
Creator
Author

Shall we add more if within if..?

Can you give some clue for point no.1 and 2..?

1. put additional condition in the if structure to exclude the future dates in calculated dim/expression..?

2. How to add more condition in the below expressions.

   If([Relieving Date]>=vCalDate10 And [Relieving Date]<=vToday, 1,0)

  More conditions :  [FROM]={'*MARIAM*'},[EMPSTATUS]={'Current'},[TO]="$(vPlaces)"

 

saivina2920
Creator
Creator
Author

Sorry again to re-open this post.

we tried many ways. but one part is working and another part is not working for exclude future date's

If INPUT is blank, we avoided to exclude the future dates ==> It's working and count is coming perfect.

If INPUT is has some values, then nothing will come ==> It's not working.

Input Count is wrong-03JAN2021-1.PNG

below we added some conditions to exclude future date's (Highlighted in Expressions). But, it will work only one side if input is blank.

For Dimensions

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

Exp1 : ("Relieving_Date") Label

=If(vUserInput, if(IsNull([EMP_RELIEVE_DATE]) and EMP_RELIEVE_DATE<=Today(),
Date(EMP_RESIGN_DATE+vUserInput)),
if(not IsNull([EMP_RELIEVE_DATE]) and EMP_RELIEVE_DATE<=Today(),
Date(EMP_RELIEVE_DATE)))

Exp2 : (1-10days)

If([Relieving_Date]>=vCalDate10 And [Relieving_Date]<=vToday and EMP_RELIEVE_DATE<=Today(), 1,0)

Also, if i add additional conditions, shall i pass parameter in both dim/expr. (all dim/expressions)

Ex:

 More conditions :  [FROM]={'*MARIAM*'},[EMPSTATUS]={'Current'},[TO]="$(vPlaces)"

If([Relieving Date]>=vCalDate10 And [Relieving Date]<=vToday AND [FROM]='*MARIAM*' AND [EMPSTATUS]='Current' AND [TO]='$(vPlaces)', 1,0) ==> Will it work..??????

How to solve this...?

pls. find the latest attachment

 

 

saivina2920
Creator
Creator
Author

anyone can pls update this thread. this is urgently required and long pending activities.

waiting for favor reply.

saivina2920
Creator
Creator
Author

Any update...