Debit – Credit SQL Formula

I am trying to write what I thought would be a pretty simple formula for a transaction search

{debitamount}-{creditamount}

It is just coming up blank.

I am trying to get  both invoices and journals onto a single search and do a summary total, which I cannot do using the transaction total since that doesn’t exist for a journal.

Anyone know a trick to get this to work?

 

I’d also like to get this to work in an Analytics dataset as well.

 

Rookie Asked on July 25, 2023 in SuiteAnalytics.
Add Comment
7 Answer(s)

Formula currency = CASE WHEN {debitfxamount} is NULL THEN 0 ELSE {debitfxamount} END)-(CASE WHEN {creditfxamount} is NULL THEN 0 ELSE {creditfxamount} END)

Or you can use
Formula currency = nvl({debitfxamount},0) – nvl({creditfxamount},0)

Rookie Answered on July 25, 2023.
Add Comment

Neither of those is working for me.  I’m not sure what the issue is.  I have values in those fields.

Rookie Answered on July 25, 2023.
Add Comment

this is the error I’m getting in analytics

You have syntax error in your formula (Unsupported element: syntax error, state:598 at the end of formula). Please see the documentation for supported syntax. (Error on line 1 column 137.)

Rookie Answered on July 25, 2023.
Add Comment

Sorry I don’t see it’s for dataset

coalesce({debitfxamount},0) – coalesce({creditfxamount},0)

Rookie Answered on July 25, 2023.
Add Comment

TO_NUMBER({transactionlines.debitforeignamount})-TO_NUMBER({transactionlines.creditforeignamount})

Rookie Answered on July 25, 2023.
Add Comment

It’s not very clear what you want

The totalamount for the JE is always 0 because debit=credit

I think you need to compare only total amount with credit amount or debit amount

Rookie Answered on July 25, 2023.

I am trying to a line total for journals and invoices.  not a total transaction total.  I am working on either a saved search or a dataset, whichever one is actually going to work

Is there a way to paste a screenshot in here?

 

on July 25, 2023.

a line item on a journal looks like this

Debit 100    Credit 0

Debit 0   Credit 100

I want a column that will show

debit – credit = 100

debit – credit = -100

 

Then I can put a summary on the formula to get the 0

 

on July 25, 2023.
Add Comment

I was able to get this to work in a dataset

CASE WHEN {transactionlines.accountingimpact.debit#currency_consolidated} is NULL THEN 0 ELSE {transactionlines.accountingimpact.debit#currency_consolidated} END)-(CASE WHEN {transactionlines.accountingimpact.credit#currency_consolidated} is NULL THEN 0 ELSE {transactionlines.accountingimpact.credit#currency_consolidated} END

Thanks for the help!

 

Rookie Answered on July 25, 2023.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.
  • This site made possible by our sponsors:   Tipalti   Celigo   Limebox   Become a Sponsor   Become a Sponsor