Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi,
I'm new to Power BI and DAX and have made a newbie mistake in totalling a measure on a report I was creating. I've fixed it, but still don't understand why it needs to be this way... hoping someone can help explain it to me.
The basic requirement is to report on product sales - the average quantity sold per month over 6 months, and what the cost would be to purchase 1 month of stock at the current average cost.
My data model is as follows:
To explain the tables:
K8_OS_01_BUFFR is where all sales transactions are held, line by line.
K8_BR_01_PRODF is the product file where cost is held.
K8_CF_01_CUSTF is customers (not relevant for this question)
To begin with I set up a table of product, sum of quantity, monthly average sales and average cost. My monthly average sales is a measure on K8_OS_01_BUFFR:
Monthly Average = SUM(K8_OS_01_BUFFR[QUANTITY]) / 6
I then created another measure, Purchase Cost 1 Month, like so:
Purchase Cost 1 month = [Monthly Average] * AVERAGE(K8_OS_01_BUFFR[Average Cost])
This gives me the correct purchase cost on a line by line basis, but an incorrect total as you will see below (simplified to two products only, product description redacted for commercial confidentiality reasons)
After much searching and following this thread https://community.powerbi.com/t5/Desktop/Sum-of-a-calculated-measure-column/td-p/446458 I have discovered that I need to use SUMX and set up my measure like this
CORRECT Purchase Cost 1 Month = SUMX(K8_OS_01_BUFFR,(K8_OS_01_BUFFR[QUANTITY]/6) * K8_OS_01_BUFFR[Average Cost])
However I also thought that I should be able to use my Monthly Average measure here and set it up like this
Purch Cost with Measure = SUMX(K8_OS_01_BUFFR,[Monthly Average] * K8_OS_01_BUFFR[Average Cost])
but it doesn't work:
Please can someone help me understand the following:
Thanks 🙂
A sum of averages is different from an average of sums.
First step is to be clear on what you actually want to compute
Second step is to implement that well defined (and confirmed with your business users) logic in DAX.
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
27 | |
10 | |
10 | |
9 | |
6 |