Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
I have a transaction table and product category table.
Client buys multiple category product and I need to calculate the count of customer who purchased only type1 and type2 together minus the result of when these category are bought together along with third category
Solved! Go to Solution.
Hi @Anonymous
You can refer to the following measure, the sample data is the same as yours
Measure =
VAR a =
CALCULATETABLE (
DISTINCT ( 'Table'[Customer_id] ),
'Table'[Product_category] IN { 1, 2 }
)
VAR b =
CALCULATETABLE (
DISTINCT ( 'Table'[Customer_id] ),
'Table'[Product_category] = 3
)
RETURN
COUNTROWS ( EXCEPT ( a, b ) )
Output
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
are you able to share some sample data in text format?
Proud to be a Super User!
Transaction_id | Customer_id | Product_category |
55640237 | 7263991 | 1 |
55640237 | 7263991 | 3 |
55640237 | 7263991 | 3 |
55640237 | 7263991 | 1 |
47810976 | 538974 | 2 |
46096606 | 765478 | 1 |
Hi @Anonymous
You can refer to the following measure, the sample data is the same as yours
Measure =
VAR a =
CALCULATETABLE (
DISTINCT ( 'Table'[Customer_id] ),
'Table'[Product_category] IN { 1, 2 }
)
VAR b =
CALCULATETABLE (
DISTINCT ( 'Table'[Customer_id] ),
'Table'[Product_category] = 3
)
RETURN
COUNTROWS ( EXCEPT ( a, b ) )
Output
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
86 | |
76 | |
74 | |
56 | |
45 |
User | Count |
---|---|
117 | |
105 | |
77 | |
66 | |
64 |