Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
FelipeMendes
Contributor II
Contributor II

se a ocorrência for > que 1 hora colocar 1 se não 0

estou com dificuldades para trazer um resultado especifico

exemplo :

quero que o numero  1 seja colocado toda vez que a NRS_VINC+ASSOC>0 e ter o tempo de deslocamento maior que 1 hora se não 0.

porem da forma que fiz esta desconsiderando se o tempo deslocamento esta maior que 1 hora

ainda sou novo no qlik e não entendo muito bem as métricas.

IF(SUM(TOTAL_NRS_VINC+TOTAL_NRS_ASSOC)>0 and (min(timestamp(DATA_CHEGADA_2))-min(timestamp(DATA_ACION_2))*24)>1,1,0)

outra ajuda seria como colocar uma condição em que o tempo do deslocamento da viatura for  maior que 1 hora colocar 1 se não 0.

 

campo tempo de deslocamento " min(timestamp(DATA_CHEGADA_2))-min(timestamp(DATA_ACION_2)) "  

Labels (4)
2 Solutions

Accepted Solutions
Henrique_Prata
Contributor II
Contributor II

Hello @FelipeMendes  and thank you for your post!
Question:[EN]

if the occurrence is > 1 hour put 1 if not 0
I'm having trouble getting a specific result

example :

I want the number 1 to be placed every time the NRS_VINC+ASSOC>0 and have the travel time greater than 1 hour if not 0.

however, the way I did this is disregarding if the displacement time is greater than 1 hour

I'm still new to qlik and I don't understand metrics very well.

IF(SUM(TOTAL_NRS_VINC+TOTAL_NRS_ASSOC)>0 and (min(timestamp(DATE_ARRIVAL_2))-min(timestamp(DATA_ACION_2))*24)>1,1,0)

another help would be how to put a condition in which the vehicle travel time is greater than 1 hour put 1 if not 0.

travel time field " min(timestamp(DATE_ARRIVAL_2))-min(timestamp(DATA_ACION_2)) "

Solution:[PT-BR]
Bom, eu acredito que seja possível alcançar o resultado desejado usando um if. Ficaria mais ou menos algo desse jeito:

if(Sum([field 1])+Sum([field 2])>0,1,0)

Ou seja, sempre que NRS_VINC+ASSOC>0 então1, senão 0. A função if admite três parâmetros if(condição, então,senão ) e observe que as três foram usadas no exemplo acima.

Para maiores informações sobre o uso do if da uma olhada aqui (https://help.qlik.com/en-US/sense/June2020/Subsystems/Hub/Content/Sense_Hub/Scripting/ConditionalFun...).

Solution:[EN]
I believe that what you're trying to achieve can be done by suing a simple if. It would be something like this:

 

if(Sum([field 1])+Sum([field 2])>0,1,0)

 

In other words, every time  NRS_VINC+ASSOC>0 then1, else 0. The if function has three parameters if(condition, then and else) and notice that they have all been used in the example above.

For further information regarding the correct use if have a look here (https://help.qlik.com/en-US/sense/June2020/Subsystems/Hub/Content/Sense_Hub/Scripting/ConditionalFun...).

 

View solution in original post

FelipeMendes
Contributor II
Contributor II
Author

Então , eu refiz conforme a sua instrução  e ficou assim 

IF((min(timestamp(DATA_CHEGADA_2))-min(timestamp(DATA_ACION_2)))*24>1,1,0)

Depois que fiz dessa forma ele me trouxe o resultado desejado .

eu vi que não fazia  sentido eu usar  NRS_VINC+ASSOC sendo que eu queria apenas que el me dissesse quando tempo de deslocamento fosse >1 ,1,0

 

View solution in original post

3 Replies
Henrique_Prata
Contributor II
Contributor II

Hello @FelipeMendes  and thank you for your post!
Question:[EN]

if the occurrence is > 1 hour put 1 if not 0
I'm having trouble getting a specific result

example :

I want the number 1 to be placed every time the NRS_VINC+ASSOC>0 and have the travel time greater than 1 hour if not 0.

however, the way I did this is disregarding if the displacement time is greater than 1 hour

I'm still new to qlik and I don't understand metrics very well.

IF(SUM(TOTAL_NRS_VINC+TOTAL_NRS_ASSOC)>0 and (min(timestamp(DATE_ARRIVAL_2))-min(timestamp(DATA_ACION_2))*24)>1,1,0)

another help would be how to put a condition in which the vehicle travel time is greater than 1 hour put 1 if not 0.

travel time field " min(timestamp(DATE_ARRIVAL_2))-min(timestamp(DATA_ACION_2)) "

Solution:[PT-BR]
Bom, eu acredito que seja possível alcançar o resultado desejado usando um if. Ficaria mais ou menos algo desse jeito:

if(Sum([field 1])+Sum([field 2])>0,1,0)

Ou seja, sempre que NRS_VINC+ASSOC>0 então1, senão 0. A função if admite três parâmetros if(condição, então,senão ) e observe que as três foram usadas no exemplo acima.

Para maiores informações sobre o uso do if da uma olhada aqui (https://help.qlik.com/en-US/sense/June2020/Subsystems/Hub/Content/Sense_Hub/Scripting/ConditionalFun...).

Solution:[EN]
I believe that what you're trying to achieve can be done by suing a simple if. It would be something like this:

 

if(Sum([field 1])+Sum([field 2])>0,1,0)

 

In other words, every time  NRS_VINC+ASSOC>0 then1, else 0. The if function has three parameters if(condition, then and else) and notice that they have all been used in the example above.

For further information regarding the correct use if have a look here (https://help.qlik.com/en-US/sense/June2020/Subsystems/Hub/Content/Sense_Hub/Scripting/ConditionalFun...).

 

FelipeMendes
Contributor II
Contributor II
Author

Então , eu refiz conforme a sua instrução  e ficou assim 

IF((min(timestamp(DATA_CHEGADA_2))-min(timestamp(DATA_ACION_2)))*24>1,1,0)

Depois que fiz dessa forma ele me trouxe o resultado desejado .

eu vi que não fazia  sentido eu usar  NRS_VINC+ASSOC sendo que eu queria apenas que el me dissesse quando tempo de deslocamento fosse >1 ,1,0

 

Henrique_Prata
Contributor II
Contributor II

[PT-BR]
Legal @FelipeMendes , se o resultado desejado foi alcançado você pode marcar a resposta como  Accept as Solution.

[EN]
Good to know Felipe, if the desired outcome was achieved please mark the answer as Accept as Solution.