> For the complete documentation index, see [llms.txt](https://smartbooks.gitbook.io/smartbooks-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://smartbooks.gitbook.io/smartbooks-docs/data-models/financial-planning/formulas/account.md).

# Account()

The Account() function retrieves the value of an account and supports optional filters such as year, period, cost center, view, and module. When no additional filters are provided, it returns the current period's value for the specified account.

### Which accounts can you reference?

Account() works across your entire reporting structure. You can reference:

* **Profit and Loss accounts**, by GL code or name.
* **Balance Sheet accounts**, by GL code or name. Balance Sheet positions are referenced the same way as P\&L accounts, which is what makes a cash flow forecast possible. See [Creating a Cash Flow Forecast](https://smartbooks.gitbook.io/smartbooks-docs/data-models/financial-planning/creating-a-cash-flow-forecast).
* **Subfolders**, by code or name. This returns the subtotal of everything underneath the subfolder.
* **Metrics**, by their unique code (for example SB\_GMA%).
* **Module accounts**, by using the module parameter with the module alias.

For Balance Sheet accounts you often want the movement between periods rather than the closing balance. Use [Movement()](https://smartbooks.gitbook.io/smartbooks-docs/data-models/financial-planning/formulas/movement) for that.

### Important

If you consistently need to reference the previous period or the same period in the previous year, always use the dedicated functions PreviousPeriod() or PreviousYear(), rather than using Account() with period or year set to -1. This approach ensures clarity and consistency in your formulas.

### Syntax

Account(account, cost\_center='cost\_center', period=-1, year=-1, view='periodic', module='module')

### Parameters

* **account:** The account code or name. When referencing another account, enclose its code in quotes (e.g. Account("4500")).
* **cost\_center:** The cost center code.
* **period:** Accepts values from -1 to -12. For instance, period = -1 returns the value from the previous period. If no period is specified, the current period's value is used.
* **year:** Specifies the year from which to retrieve the account value. For example, year = -1 combined with period = -1 lets you use the actual value from the previous corresponding period when planning for a future period.
* **view:** Either 'ytd' or 'periodic'.
* **module:** The module alias.

### Examples

**Basic usage** Retrieve the current value of account 4500: Account('4500')

**Using multiple filters** Retrieve the value of account 4500 from two periods before the current period in the previous year: Account('4500', period=-2, year=-1)

**Combining accounts** Multiply the value of account 4500 by a specified gross margin percentage (SB\_GMA%): Account('4500') \* Account('SB\_GMA%')

**Referencing a Balance Sheet account** Carry the planned net result into your profit reserves: PreviousPeriod() + Account('SB\_Profit\_and\_Loss')

**Referencing a subfolder** Return the subtotal of an entire subfolder by its name: Account('Current Assets')

**Using cost centers or other business dimensions** Cross-business dimension references are not allowed in Smartbooks. You can refer to cost centers for total calculations, but not to populate other business dimensions. For example: Account('4500', cost\_center='8500')

### Recommended approach for previous period/year

For the previous period's value, use PreviousPeriod("account\_code"). For the same period in the previous year, use PreviousYear("account\_code").
