4 Replies Latest reply: Apr 19, 2016 5:56 AM by Andrew Mein

# complex if statement with interval - qlik sense

Hiya

I am trying a complex expression with a if statement with interval.

I have a person who records room temperature at different intervals of the day.

i have an expression

interval(min({<Temp={'40'}>} ObserveDateTime) - min({<Temp={'>40'}>} ObserveDateTime) ,'h:mm' )

this records how long it takes for a room to reach 40 in temperature

usally from observe number 1 to the observation number when temperature has been met. e.g 1 - 5

recorded by ObserveNumber 1, 2, 3 ect

This above works fine however, sometimes a recording has been done before opening time

i wish to create an if statement like

sum(if(min(ObserveDateTime)  < OpeningDateTime , then start from ObserveNumber 2 instead of number 1

• ###### Re: complex if statement with interval - qlik sense

Maybe something like

interval(min({<Temp={'40'}>} ObserveDateTime) - min({<Temp={'>40'}, ObserveDateTime = {"=ObserveDateTime>=OpeningDateTime"}>} ObserveDateTime) ,'h:mm' )

edit: It would be easier to help you if you describe your data model and data a bit more in detail.

Maybe by posting some sample lines of data, e.g. as INLINE tables.

Or by posting a small sample app.

• ###### Re: complex if statement with interval - qlik sense

It would be easier to help you if you could describe your data model and data a bit more in detail.

We need to know how all the involved fields are related, for example ObserveDateTime and OpeningDateTime.

Maybe by posting some sample lines of data, e.g. as INLINE tables.

Or by posting a small sample app.

• ###### Re: complex if statement with interval - qlik sense

Perhaps:

interval(max({<Temp={'40'}>} ObserveDateTime) - min({<Temp={'>40'}>} IF(ObserveDateTime > OpeningDateTime,ObserveDateTime)) ,'h:mm' )