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: 
Krish-BI_Engineer
Contributor II
Contributor II

If Statement to define a Calculated Dimension

Hi Friends, Qlikview Techies :

I need to derive a Column based on multiple conditions on dates/ time columns, as shown below.

I've tried in 'Calculated Dimension' field that to be used/displayed in a Chart.

If( [Event Time] > [Estimation_End_Time],'Late', if([Event Time] < [Estimation_Start_Time],'Early',if([Estimation_Start_Time]<[Event Time] <[Estimation_End_Time],'Within Time'
))) 

the editor dialogue box says "error in the expression". But, I'm not sure of the fix/ solution.

col label name: Precison_Time

Can you please help in solving this issue.

Thanks in Advance,

KT.

Labels (1)
2 Solutions

Accepted Solutions
deepanshuSh
Creator III
Creator III

If( [Event Time] > [Estimation_End_Time],'Late', if([Event Time] < [Estimation_Start_Time],'Early',if([Estimation_Start_Time]<[Event Time] <[Estimation_End_Time],'Within Time'
))) 

 

The '[Estimation_Start_Time]<[Event Time] <[Estimation_End_Time],' seems incorrect to me you need to define the or, or and condition here to compare the three values simultaneously. Also, please check if all the values are in same formating and presented in same manner by putting individual values into the boxes and checking if conditions are true or not. 

Trial and error is the key to get unexpected results.

View solution in original post

deepanshuSh
Creator III
Creator III

No, problem. Glad it worked out. 

Please close the thread to avoid any further responses to the post. 

Trial and error is the key to get unexpected results.

View solution in original post

3 Replies
deepanshuSh
Creator III
Creator III

If( [Event Time] > [Estimation_End_Time],'Late', if([Event Time] < [Estimation_Start_Time],'Early',if([Estimation_Start_Time]<[Event Time] <[Estimation_End_Time],'Within Time'
))) 

 

The '[Estimation_Start_Time]<[Event Time] <[Estimation_End_Time],' seems incorrect to me you need to define the or, or and condition here to compare the three values simultaneously. Also, please check if all the values are in same formating and presented in same manner by putting individual values into the boxes and checking if conditions are true or not. 

Trial and error is the key to get unexpected results.
Krish-BI_Engineer
Contributor II
Contributor II
Author

Ok, I got the issue with the AND operator missing among the fields used, in the 3rd nested If condition. later, it worked fine. thanks @deepanshuSh for your quick response on my query.

deepanshuSh
Creator III
Creator III

No, problem. Glad it worked out. 

Please close the thread to avoid any further responses to the post. 

Trial and error is the key to get unexpected results.