Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi,
I have a table structure like this:
Table: Order
OrderId | Quantity |
1 | 10 |
2 | 2 |
Table: OrderItem
OrderId | ItemId | Value |
1 | 1 | 15 |
1 | 2 | 6 |
2 | 1 | 12 |
Table: Item
ItemId | Name |
1 | Door |
2 | Window |
Now I want to have a visual to show the average sold value of the items. But it should take the quantity into account:
Item | Average value |
Door | (15*10 + 12*2) / 12 = 14.5 |
Window | (6*10) / 10 = 6 |
How can I create the "Average value" column?
Thx!
Solved! Go to Solution.
as I could imagine you need smth like
Column = DIVIDE(calculate(SUMX('Table (2)', 'Table (2)'[Value]*RELATED('Table'[Quantity]))), calculate(SUMX('Table (2)', 'Table (2)'[Value])))
but you need check columns depending on your business logic
as I could imagine you need smth like
Column = DIVIDE(calculate(SUMX('Table (2)', 'Table (2)'[Value]*RELATED('Table'[Quantity]))), calculate(SUMX('Table (2)', 'Table (2)'[Value])))
but you need check columns depending on your business logic
Thx! @az38 and @Anonymous
I believe this would be the correct version:
Test = DIVIDE(CALCULATE(SUMX(OrderItem; OrderItem[Value] * RELATED(Order[Quantity]))); CALCULATE(SUMX(OrderItem; RELATED( Order[Quantity]))))
@az38, do you need calculate around the SUMX expressions? If so, why?
@Robert-bpd, az38:s solutions looks good, but of course it requires proper releations between the tables.
whydo you divide Door by 12?
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
10 | |
10 | |
10 | |
9 | |
7 |
User | Count |
---|---|
17 | |
12 | |
11 | |
11 | |
10 |