Help with expression

Hi 

I am needing help with this

I got the expression correct but the results are not correct

IF
( AND
(OR
(
[Tank or Gauge Name]=“66018”,
[Tank or Gauge Name]=“Sales Tank #1”),

[Previous Day].[Total-Inches]< [Total-Inches]) ,
[Oil-Bbls]-[Previous Day].[Oil-Bbls],

"IF ([Tank or Gauge Name]=“11955”,[Previous Day].[Total-Inches]> [Total-Inches]) ,
[Previous Day].[Oil-Bbls]-[Oil-Bbls]")

@Steve 

@MultiTech 

 

0 3 101
3 REPLIES 3

Aurelien
Google Developer Expert
Google Developer Expert

Hi @ABBA 

I re-indented the expression so that it's easier for me to read.

 

IF( 
  AND(
   OR(    
      [Tank or Gauge Name]=“66018”,
      [Tank or Gauge Name]=“Sales Tank #1”
    ),
    [Previous Day].[Total-Inches]< [Total-Inches]
  ),
  [Oil-Bbls]-[Previous Day].[Oil-Bbls],
  "IF ([Tank or Gauge Name]=“11955”,[Previous Day].[Total-Inches]> [Total-Inches]) ,[Previous Day].[Oil-Bbls]-[Oil-Bbls]"
)

 

 It seems correctly in terms of syntax, indeed, although the output is not matching between the result-true and result-false.

From my understanding:

- result-true is a numeric output

- result-false is a text-output

You may need to change one of these.

Did you want to make this?

 

IF( 
  AND(
   OR(    
      [Tank or Gauge Name]=“66018”,
      [Tank or Gauge Name]=“Sales Tank #1”
    ),
    [Previous Day].[Total-Inches]< [Total-Inches]
  ),
  [Oil-Bbls]-[Previous Day].[Oil-Bbls],
  IF (
    [Tank or Gauge Name]=“11955”,
    [Previous Day].[Total-Inches]> [Total-Inches] ,
    [Previous Day].[Oil-Bbls]-[Oil-Bbls]
  )
)

 

 If so, you may want to use IFS() expression instead of nested IF() expressions.

Here is my suggestion:

 

IFS( 
  AND(
   OR(    
      [Tank or Gauge Name]=“66018”,
      [Tank or Gauge Name]=“Sales Tank #1”
    ),
    [Previous Day].[Total-Inches]< [Total-Inches]
  ),
    [Oil-Bbls]-[Previous Day].[Oil-Bbls],
  [Tank or Gauge Name]=“11955”,
    [Previous Day].[Total-Inches]> [Total-Inches] ,
  TRUE,
    [Previous Day].[Oil-Bbls]-[Oil-Bbls]
)

 

For reference:

IFS() - AppSheet Help

 

Hi @ABBA 

Please post such queries in the "Q&A" section. Also you have also posted this same question in the "Q&A" section. May we request you to post only once a question. You will get the best response in one thread. The guidance by @Aurelien  in this thread is not available in another thread and @Aurelien may not know what others have suggested. 

Good point @Suvrutt_Gurjar , I didn't notice this was not in the correct category ! 😅

Top Labels in this Space