Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
I need to come up with a solution to the problem below.
I want to count the number of unique Users (User ID) who only buy Product A. The answer the chart below would be 2 unique users. User ID 11 and User ID 13
ID | User ID | Product | Amount |
1 | 10 | A | 10 |
2 | 10 | B | 5 |
3 | 11 | A | 10 |
4 | 12 | C | 20 |
5 | 13 | A | 10 |
6 | 12 | A | 10 |
7 | 11 | A | 10 |
Solved! Go to Solution.
Hi @Anonymous ,
Try the following measure:
Users for product A = COUNTROWS ( FILTER ( ADDCOLUMNS ( SUMMARIZE ( ALL ( Sales[Product]; Sales[User ID] ); Sales[Product]; Sales[User ID] ); "Count"; CALCULATE ( DISTINCTCOUNT ( Sales[Product] ); ALLEXCEPT ( Sales; Sales[User ID] ) ) ); [Count] = 1 && Sales[Product] = "A" ) )
Regards,
MFelix
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHi @Anonymous
You may try below measure:
UniqueCount = VAR _table = SUMMARIZE ( Sales, Sales[User ID], "Count", DISTINCTCOUNT ( Sales[Product] ) ) RETURN CALCULATE ( DISTINCTCOUNT ( Sales[User ID] ), FILTER ( _table, [Count] = 1 && MAX ( Sales[Product] ) = "A" ) )
Regards,
Hi @Anonymous ,
You have two option to make this:
Assuming you are making this on a card visual (but works for other type of visuals
Option 1:
Option 2:
Users for product A = CALCULATE(DISTINCTCOUNT(Sales[Users]);Sales[Product] = "A")
Depending on the way you want to show the information both have advantages and disavantages.
Regards,
MFelix
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsThanks @MFelix ,
I was not clear in my original answer I have updated the original question to better address my need. Your current solutions will count all Users with product "A". I only want the unique user count for users who purchased only Product "A" and nothing else.
Thanks.
Hi @Anonymous ,
Try the following measure:
Users for product A = COUNTROWS ( FILTER ( ADDCOLUMNS ( SUMMARIZE ( ALL ( Sales[Product]; Sales[User ID] ); Sales[Product]; Sales[User ID] ); "Count"; CALCULATE ( DISTINCTCOUNT ( Sales[Product] ); ALLEXCEPT ( Sales; Sales[User ID] ) ) ); [Count] = 1 && Sales[Product] = "A" ) )
Regards,
MFelix
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsThis is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
72 | |
70 | |
57 | |
37 | |
36 |
User | Count |
---|---|
85 | |
65 | |
60 | |
46 | |
45 |