1. Home
  2. Docs
  3. Best practice
  4. Expenses distribution

Expenses distribution

Task. The company manages real estate which owners are not. There are total expenses for a group of objects, for example, Cleaning and Security. We need to distribute expenses for each object. See Fig.1

Figure 1. Expenses distribution example.

HubCloud Syntax:

Catalog.Property | GroupBy (area); – calculate total area

Expenses | GroupBy( item, amount as amount_group); – get expenses data

Catalog.Property | Select (id, area) | AddColumn( total_area, Number, $result_1) | FullJoinAuto ($result_2,) | Compute (amount_one, area * amount_group / total_area ) – calculate result