- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

How to calculate an amount in a column of invoices according to a column of months?
How can I calculate an amount in a certain column according to the month that is in the same row with it in the invoices table and it is linked to a table of dates, I want to calculate a total amount for each month separately throughout all the years (for example: January 2018-2023, February 2018-2023, etc.).
I need to average by month over the years.
Many thanks to the helpers.facr invoices table
dim date table
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi @Shlomiaf7 ,
Here are my test data snapshots. There are two tables.
Then follow steps:
1.To achieve calculate total according to selected year and month range, create measure like below:
Total =
var _years=ALLSELECTED('date'[Year])
var _months=ALLSELECTED('date'[Month])
RETURN CALCULATE(
SUM('invoices'[Amount]),
FILTER(
'invoices',
YEAR('invoices'[year_month]) in _years && MONTH('invoices'[year_month]) in _months
)
)
2. To achieve calculate average according to selected year and month range, create measure like below:
Average =
var _years=ALLSELECTED('date'[Year])
var _months=ALLSELECTED('date'[Month])
RETURN CALCULATE(
AVERAGE('invoices'[Amount]),
FILTER(
'invoices',
YEAR('invoices'[year_month]) in _years && MONTH('invoices'[year_month]) in _months
)
)
3.Final output
In order for you to solve the problem faster, you can refer to the following documentation.
How to Get Your Question Answered Quickly - Microsoft Fabric Community
Best regards,
Albert HE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi @Shlomiaf7 ,
Here are my test data snapshots. There are two tables.
Then follow steps:
1.To achieve calculate total according to selected year and month range, create measure like below:
Total =
var _years=ALLSELECTED('date'[Year])
var _months=ALLSELECTED('date'[Month])
RETURN CALCULATE(
SUM('invoices'[Amount]),
FILTER(
'invoices',
YEAR('invoices'[year_month]) in _years && MONTH('invoices'[year_month]) in _months
)
)
2. To achieve calculate average according to selected year and month range, create measure like below:
Average =
var _years=ALLSELECTED('date'[Year])
var _months=ALLSELECTED('date'[Month])
RETURN CALCULATE(
AVERAGE('invoices'[Amount]),
FILTER(
'invoices',
YEAR('invoices'[year_month]) in _years && MONTH('invoices'[year_month]) in _months
)
)
3.Final output
In order for you to solve the problem faster, you can refer to the following documentation.
How to Get Your Question Answered Quickly - Microsoft Fabric Community
Best regards,
Albert HE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

according to the month that is in the same row with it in the invoices table
not sure what you mean by that. What is the join column?
Please provide sample data (with sensitive information removed) that covers your issue or question completely, in a usable format (not as a screenshot). Leave out anything not related to the issue.
If you are unsure how to do that please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Please show the expected outcome based on the sample data you provided.
If you want to get answers faster please refer to https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Helpful resources
Join us at the Microsoft Fabric Community Conference
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Power BI Monthly Update - February 2025
Check out the February 2025 Power BI update to learn about new features.

Subject | Author | Posted | |
---|---|---|---|
05-20-2024 10:36 AM | |||
08-05-2024 11:08 PM | |||
04-27-2024 03:07 AM | |||
10-26-2023 02:52 AM | |||
02-11-2024 12:12 AM |