Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Anonymous
Not applicable

Calculate average from detail table grouped by account

I am fairly new to DAX and could use some help.  I have a detailed transaction table that has one or more records per day for an account that should a transaction amount.  What I would like to end up with is a chart or table that would then show a monthly average per account based on the filters.

 

Sample Data:

AccountDateAmount
11/1/20235
12/1/202310
21/5/202340
21/5/20235
22/10/202330
33/1/202325
34/15/202375
44/1/2023100

 

I would like my results to look like this:

MonthAverage per account
Jan25
Feb20
March25
April

87.5

 

Of course, I would also like it to be based on the filters (accounts and dates) that I select.

 

Thanks in advance for the help.

1 ACCEPTED SOLUTION
Vitalii777
New Member

Given your table is named as "Transactions", you can calculate the average per account per month using a DAX measure. First, you need to create a new calculated column "Month" in your table:

Month = FORMAT(Transactions[Date], "MMM")
Then DAX measure:
AveragePerAccountMonth =
AVERAGEX(
SUMMARIZE(
Transactions,
Transactions[Account],
Transactions[Month],
"MonthlyAmount", SUM(Transactions[Amount])
),
[MonthlyAmount]
)





View solution in original post

2 REPLIES 2
Vitalii777
New Member

Given your table is named as "Transactions", you can calculate the average per account per month using a DAX measure. First, you need to create a new calculated column "Month" in your table:

Month = FORMAT(Transactions[Date], "MMM")
Then DAX measure:
AveragePerAccountMonth =
AVERAGEX(
SUMMARIZE(
Transactions,
Transactions[Account],
Transactions[Month],
"MonthlyAmount", SUM(Transactions[Amount])
),
[MonthlyAmount]
)





Anonymous
Not applicable

@Vitalii777   That's exactly what I was looking for, I just wasn't sure how to get the syntax right.  Thanks!

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.