Forum Discussion
Count Customers by Product in Order/LineItem Structure
- Anonymous6 years ago
Hi BoCoKeith
If you change the relationship from single to both, you will find the answer is correct.
But Both direction is not recommended in Power BI. So you may try to use measure or merge to achieve your goal.
Measure:
Discount CustomerID = CALCULATE(DISTINCTCOUNT(temp_Order[CustomerId]),CROSSFILTER(temp_LineItem[OrderId],temp_Order[OrderId],Both))Result:
Merge:
Select Merge Queries as New.
1. Merge temp_Product and temp_LineItem by ProductID column in each table
2. Merge New Table and temp_Order by OrderID column in each table.
The Final table is as below.
Result:
You can download the pbix file from this link: Count Customers by Product in Order/LineItem StructureBest Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi BoCoKeith
If you change the relationship from single to both, you will find the answer is correct.
But Both direction is not recommended in Power BI. So you may try to use measure or merge to achieve your goal.
Measure:
Discount CustomerID = CALCULATE(DISTINCTCOUNT(temp_Order[CustomerId]),CROSSFILTER(temp_LineItem[OrderId],temp_Order[OrderId],Both))Result:
Merge:
Select Merge Queries as New.
1. Merge temp_Product and temp_LineItem by ProductID column in each table
2. Merge New Table and temp_Order by OrderID column in each table.
The Final table is as below.
Result:
You can download the pbix file from this link: Count Customers by Product in Order/LineItem Structure
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.