3votes

How do i rollup by months

I am trying to make a financial dashboard. I have currently 4 databases. Accounts, Expense, Income and Budget. I am trying to display monthly income in my accounts table using rollup but i keep getting the sum of current and past months. Any advice on how to solve this?

2 Answers

1vote

polle Points102630

You need to filter your view by month, there is no need to use a Rollup for that.

That way you will just see by month everything and at the bottom you can use the calculate options to see the totals.

2votes

commented Jan 2, 2023

n my account database, i want to see my monthly expense and income.

https://branched-scarer-bb8.notion.site/Finance-Tracker-f58a30c3c4fa4d26921d75e1f0b81ffb

This is what i have currently. but i have no idea of how to display the total income and expense, while having a monthly income and expense under acco

1vote

commented Jan 2, 2023

In the income section you have a monthly view and there is the sum of the Amount column.

Below that you have another table for Date and that shows correctly the sum for each month in the rollup.

What is the problem?

2votes

commented Jan 2, 2023

I want to display that sum inside the account table.

1vote

commented Jan 2, 2023

You have to also relate the Date database to account, so accounts can have the rollup showing the sum, exactly as you have it in income.

2votes

commented Jan 3, 2023

ahh i see. Thanks. then to show yearly i should create a year table as well?

1vote

commented Jan 9, 2023

If you plan to have years and count them, like use the information by year as well, then yes, that would be the best to do.

Otherwise just pull everything with no filters at all.

If you consider the question solved, please select the answer to mark it.

0vote

freelancerops Points780

Plain rollups can't filter by date, so you get the sum of every month. A formula on the Accounts database can filter the relation instead. Assume the relation to Income is called "Income" and has Date and Amount:

prop("Income")
  .filter(formatDate(current.prop("Date"), "YYYY-MM") == formatDate(now(), "YYYY-MM"))
  .map(current.prop("Amount"))
  .sum()

Name it Income this month. Make the same formula for Expense, and Net = Income this month − Expense this month.

For past months, add a Date property called "Month" to the account (or the dashboard row) and compare it against that instead of now(). Another option is a Months database (one row per month) related to each transaction, where a plain rollup Sum works per month.

For a quick visual, a chart view on Income grouped by Date (month) also works.

Free template with the client and project side of a freelance setup: https://2rds.github.io/freelancer-ops/lite.html?ref=notionanswers

Please log in or register to answer this question.

...

Welcome to Notion Answers, where you can ask questions and receive answers from other members of the community.

Please share to grow the Notion Community!

Connect