Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
karolisarb
Regular Visitor

How to count individual product price in order?

3fOMB

 

I have a bunch of orders with products in a list. Two products, marked red, are displayed in separate rows but products are the same. The quantity did not not sum of those two products in database, but the total price is summed.

Problem is that total price shows the total sum of same two products. And if there are more than one same product in order displayed in separate row, those rows total price sums together.

Can anyone help me with filters? If in an order there is more than one of the same product displayed in separate row, I want that the total price won't be calculated between them.

I need another column, were price is calculated in this way: if there is more than one product with same product code in same order (order id) then the total price should be devided by quantity of sum of same products

 

101023 | 2017-03-06 | 7610917627158 | 1 | 14.86 | 7.43 (new column)

101023 | 2017-03-06 | 7610917627158 | 1 | 14.86 | 7.43 (new column)

1 ACCEPTED SOLUTION

You could also try adding a group by on the Order, Product ID, and Amount then using aggregations on your quantity and total amount.

 

If this is your starting dataset, with the top two records the same product from the same order add a group by like below, grouping on order, product, and amount.

 

 

 Before.PNG

 

 

 

 

You will end up with the dataset below, where you can then easily add a new column that divides the unique amount by the total quantity:

 

AddColumn.PNG

 

The final result would be like below:

 

After.PNG

View solution in original post

4 REPLIES 4
dataloreous
Advocate III
Advocate III

I would first try to change the query from the source to only return distinct records. If that does not work or you do not have control over the source use the 'Remove Duplicates' option to add a step to the query. That will leave you with unique records in your query which can then be summed easily.

 

Reduce Rows --> Remove Rows --> Remove Duplicates

I think 'Remove duplicated rows' will remove the quantity

You could also try adding a group by on the Order, Product ID, and Amount then using aggregations on your quantity and total amount.

 

If this is your starting dataset, with the top two records the same product from the same order add a group by like below, grouping on order, product, and amount.

 

 

 Before.PNG

 

 

 

 

You will end up with the dataset below, where you can then easily add a new column that divides the unique amount by the total quantity:

 

AddColumn.PNG

 

The final result would be like below:

 

After.PNG

Thank you! It works

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.