Forum Discussion
bgirish
8 years agoFrequent Visitor
Summning data from different rows
I've got a table called 'orders' order_id, customer_id 1001, 5000 1002, 5432 and another 'order_detail' with multiple rows per order order_detail_id, order_id, type, value 1, 1001, ite...
alexei7
8 years agoContinued Contributor
Hi bgirish,
Presuming you have the two tables joined by order_id in the relationships view, try the following:
Revenue = CALCULATE(SUM(order_detail[value]),order_detail[type]="item")-CALCULATE(SUM(order_detail[value]),order_detail[type]="discount")
Hope that helps,
Alex