Forum Discussion
Average amount per transaction DAX
Hello, my problem looks like simple, but I’m struggling to solve it.
I have Sales table.
I have the number of transactions per customer measure
Number of transactions = COUNTROWS(GROUPBY(SALES,SALES[date],SALES[Customer]))
In the same table I have Σ SalesAmount.
So my task is just to Divide([Σ SalesAmount], [Number of transactions])
Besides it gives me very small figures.
May be Should I use FILTER(SALES, SALES[SalesAmount] <> 0 ), or use groupby somewhere.
Thank you for any help.
Anonymous simply add following measures, you can do it in one measure for debugging and easy reading, I prefer explicit measure for each calculation
Sales = SUM ( Table[SalesAmt] ) Tran Count = COUNTROWS ( Table ) Avg Sales = DIVIDE ( [Sales], [Tran Count] )You can visualize these measures by any other column you have in your table.
✨ Follow us on LinkedIn
Learn about conditional formatting at Microsoft Reactor
My latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡ Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
1 Reply
- parry2k
Super User
Anonymous simply add following measures, you can do it in one measure for debugging and easy reading, I prefer explicit measure for each calculation
Sales = SUM ( Table[SalesAmt] ) Tran Count = COUNTROWS ( Table ) Avg Sales = DIVIDE ( [Sales], [Tran Count] )You can visualize these measures by any other column you have in your table.
✨ Follow us on LinkedIn
Learn about conditional formatting at Microsoft Reactor
My latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡ Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡