Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
342dssf
Contributor II
Contributor II

Dúvida de expressão com datas

Boa noite galera, tudo bem?

 

Estou com uma dúvida e gostaria de pedir a ajuda de vocês.

 

Preciso desenvolver uma função que altere o fundo da tabela com os seguintes requisitos

Se a comparação da 'Data de solicitação' com a 'Data de entrada da NF' for igual ou menor a 3 dias = cor verde

Se a comparação da 'Data de solicitação' com a 'Data de entrada da NF' for maior que 3 dias = cor amarela

Se a comparação da 'Data de solicitação' for maior que a ' Data de entrada da NF' = cor vermelha

 

342dssf_1-1640038557362.png

 

Estou tentando a seguinte função mas as cores não estão corretas

 

IF (Data entrada NF <= Data de solicitacao -3 , 'green',
IF (Data entrada NF >= Data de solicitacao +3, 'yellow',
IF (Data de solicitacao > Data entrada NF, 'red')))

 

 

1 Solution

Accepted Solutions
Andrei_Cusnir
Specialist
Specialist

Hello,

 

If my understanding is correct, you have 2 fields (Data entrada NF and Data de solicitacao). Then you want to achieve the following:

  1. If Data de solicitacao is equal to Data entrada NF or less for 3 days, then it is going to be GREEN
  2. If Data de solicitacao is less than Data entrada NF for more than 3 days, then it is going to be YELLOW
  3. If Data de solicitacao is more than Data entrada NF, then it is going to be RED

Perhaps you can try using the following expression:

if (
 
[Data de solicitacao] > [Data entrada NF]
 
Red(),
 
If(
   
[Data de solicitacao] <= [Data entrada NF] and [Data de solicitacao] >= Date([Data entrada NF] - 3, 'MM/DD/YYYY'), 
   
Green(), 
   
Yellow()
  ),
)

 

Here is my outcome:

SCREENSHOT

 

I have added another column to calculate the differences of the dates with the expression: =[Data entrada NF] - [Data de solicitacao]. If the difference is a negative number, then [Data de solicitacao] is grater than [Data entrada NF], so the color should be RED. If the difference is a positive number 1, 2 or 3, then the color should be GREEN. Otherwise if the positive number is grater than 3, then the color should be YELLOW.

 

As you can see:

  1. For the first row: [Data de solicitacao] is grater than [Data entrada NF] by 8 days, so the color is RED
  2. For the second row: [Data de solicitacao] is less than [Data entrada NF] by 1 day, so the color is GREEN
  3. For the fourth row: [Data de solicitacao] is less than [Data entrada NF] by 10 days, so the color is YELLOW

I hope that this information was helpful. In case I have misunderstood the use case scenario, please elaborate in details by providing additional information. However, if it has helped you resolve the issue, please mark it as accepted solution to give further visibility to other community members. 

Help users find answers! Don't forget to mark a solution that worked for you! 🙂

View solution in original post

2 Replies
Andrei_Cusnir
Specialist
Specialist

Hello,

 

If my understanding is correct, you have 2 fields (Data entrada NF and Data de solicitacao). Then you want to achieve the following:

  1. If Data de solicitacao is equal to Data entrada NF or less for 3 days, then it is going to be GREEN
  2. If Data de solicitacao is less than Data entrada NF for more than 3 days, then it is going to be YELLOW
  3. If Data de solicitacao is more than Data entrada NF, then it is going to be RED

Perhaps you can try using the following expression:

if (
 
[Data de solicitacao] > [Data entrada NF]
 
Red(),
 
If(
   
[Data de solicitacao] <= [Data entrada NF] and [Data de solicitacao] >= Date([Data entrada NF] - 3, 'MM/DD/YYYY'), 
   
Green(), 
   
Yellow()
  ),
)

 

Here is my outcome:

SCREENSHOT

 

I have added another column to calculate the differences of the dates with the expression: =[Data entrada NF] - [Data de solicitacao]. If the difference is a negative number, then [Data de solicitacao] is grater than [Data entrada NF], so the color should be RED. If the difference is a positive number 1, 2 or 3, then the color should be GREEN. Otherwise if the positive number is grater than 3, then the color should be YELLOW.

 

As you can see:

  1. For the first row: [Data de solicitacao] is grater than [Data entrada NF] by 8 days, so the color is RED
  2. For the second row: [Data de solicitacao] is less than [Data entrada NF] by 1 day, so the color is GREEN
  3. For the fourth row: [Data de solicitacao] is less than [Data entrada NF] by 10 days, so the color is YELLOW

I hope that this information was helpful. In case I have misunderstood the use case scenario, please elaborate in details by providing additional information. However, if it has helped you resolve the issue, please mark it as accepted solution to give further visibility to other community members. 

Help users find answers! Don't forget to mark a solution that worked for you! 🙂
342dssf
Contributor II
Contributor II
Author

Muito obrigado meu amigo, resolveu meu problema.