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 moreShape the future of the Fabric Community! Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions. Take survey.
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.
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Check out the November 2024 Power BI update to learn about new features.
User | Count |
---|---|
93 | |
88 | |
83 | |
76 | |
49 |
User | Count |
---|---|
145 | |
140 | |
109 | |
68 | |
55 |