Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet 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
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:
Account | Date | Amount |
1 | 1/1/2023 | 5 |
1 | 2/1/2023 | 10 |
2 | 1/5/2023 | 40 |
2 | 1/5/2023 | 5 |
2 | 2/10/2023 | 30 |
3 | 3/1/2023 | 25 |
3 | 4/15/2023 | 75 |
4 | 4/1/2023 | 100 |
I would like my results to look like this:
Month | Average per account |
Jan | 25 |
Feb | 20 |
March | 25 |
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.
Solved! Go to Solution.
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]
)
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]
)
@Vitalii777 That's exactly what I was looking for, I just wasn't sure how to get the syntax right. Thanks!
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
22 | |
21 | |
19 | |
13 | |
12 |
User | Count |
---|---|
41 | |
32 | |
23 | |
22 | |
22 |