Calculate Account Balance (i.e This row vs previous dated row with conditions)

Hi Guys

I looking for a virtual column called [Balance].

Hopefully the below picture and remarks explains my situation. I would appreciate the support.

I think the expression should be something looking for the following arguments

IF([Category] = "Opening Balance}, True = This Row [Balance Value], False = This Row [Amount] + [Balance] of the previous dated row of the same account name as this row.

0 1 183
1 REPLY 1

Firstly, you should review how the inventory sample apps are set up.

https://www.appsheet.com/SampleApps



To answer your question:

Assuming you have an Account Table, that:

  • includes at least 2 records, a โ€œChequeโ€ and a โ€œCashโ€ record
  • is a Parent table to the displayed Table in your screenshot

โ€ฆand assuming there is only ever one โ€œ(Opening Balance)โ€ record (per account),

โ€ฆyou could use this, or something like it, in a Virtual Column on the Account Table:

ANY( SELECT(
  [Related...][Balance] ,
  AND(
    [Account] = [_THISROW] ,
    [Type] = "(Opening Balance)"
  )
) )
-
SUM( SELECT(
  [Related...][Balance] ,
  AND(
    [Account] = [_THISROW] ,
    [Type] <> "(Opening Balance)"
  )
) )
Top Labels in this Space