Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Trying to use IF in calculated dimension

I am trying to use the below IF statement in a calculated dimension and it does not seem to be working.

=if(A = '', (if(B= '',time(C,'hh:mm:ss'),time(B,'hh:mm:ss'))),time(A,'hh:mm:ss'))

Basically the logic is, if A is null, then check if B is null - if that's the case return C (in the time format specified), else return B (if B is not null). If A is not null, then return A.

Any help would be appreciated.

Thank you,

Amit

3 Replies
pokassov
Specialist
Specialist

Hi!

Try this

if(isnull(A), ...

or

time(alt(A,B,C),'hh:mm:ss')

dclark0699
Creator
Creator

If all three field are dual fields, meaning they have both a number format and a datetime format, you should be able to do

time(ALT(a,b,c),'hh:mm:ss')

sunny_talwar

When you say it's not working, what exactly is going wrong?


Try this may be:


=if(Len(Trim(A)) = 0,

  if(Len(Trim(B)) = 0, Time(C,'hh:mm:ss'), Time(B,'hh:mm:ss')), Time(A,'hh:mm:ss'))