Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
Dear All,
I have the following database:
Product Name | Quantity | Unitary Price |
Apple | 2 | 0,60 |
Apple | 1 | 0,60 |
Orange | 4 | 0,80 |
Banana | 3 | 0,90 |
Banana | 2 | 0,90 |
Banana | 4 | 0,90 |
I need to visualize a report with total quantity of distinct products along with their distinct unitary price and total price.
My table should looks like the following:
Product Name | Quantity | Unitary Price | Total Price |
Apple | 3 | 0,60 | 1,80 |
Orange | 4 | 0,80 | 3,20 |
Banana | 9 | 0,90 | 8,10 |
My problem is that Power BI gives me back the sum of unitary prices per product name, just like the quantities. It is good for the latter, but I don't want it for the former.
What should I do in this case?
Thank you guys
Solved! Go to Solution.
@gianmarco
This should work
Total Price =
SUMX(
VALUES(Table9[Product Name]),
CALCULATE(SUM(Table9[Quantity]) * AVERAGE(Table9[Unitary Price] ))
)
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
@gianmarco
How did you calculate 2.4 and it should be 3.2 ?
You create the following measure:
Total Price = SUM(Table[Quantity]) * AVERAGE(Table[Unitary Price] )
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
Dear @Fowmy ,
I already did that, but the total price in bold characters is wrong. It's because I do the average of the unitary price. It must be a way for which Power BI automatically associates the unitary price to the product name so I don't need to estimate the average.
@gianmarco
Please show me the expected results
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
The expected result should be:
Product Name | Quantity | Unitary Price | Total Price |
Apple | 3 | 0,60 | 1,80 |
Orange | 4 | 0,80 | 3,20 |
Banana | 9 | 0,90 | 8,10 |
Total | 16 | --- (no value) | 13,1 |
@gianmarco
This should work
Total Price =
SUMX(
VALUES(Table9[Product Name]),
CALCULATE(SUM(Table9[Quantity]) * AVERAGE(Table9[Unitary Price] ))
)
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
Yeah, my fault. It was a mistake. Thanks. I just corrected the table.
Check the solution and accept it if it works for you
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
User | Count |
---|---|
77 | |
75 | |
67 | |
65 | |
47 |
User | Count |
---|---|
108 | |
106 | |
93 | |
84 | |
66 |