Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
Levo_242
New Member

Cannot calculate and group a measure (distinct)

Hello all,

 

i hope someone could help me with my problem. I created a new measure like the following....

Total Count Product Groups = CALCULATE([Count products groups])
and i get the right results means the counting of different product groups by an opportunity product.
 
But want to know the following...
 
OpportunityTotal Count Product Groups (based on opportunity products) 
A1 
B4 
C2 
D6 
E2 
F1 
G4 
H4 
   
   
 Result should be 
 Count opportunity products with different equal Product groups
 2 Opportunities with 2 different PG 
 3 Opportunities with 4 different PG 
 1 Opportunity with 6 different PG 
 etc...... 
 
How can i create this measure??
Thanks for your support....
 
Chris
1 ACCEPTED SOLUTION
mahoneypat
Microsoft Employee
Microsoft Employee

You can use this to get the count of those with 2, for example.

 

Opps with 2 = COUNTROWS(FILTER(DISTINCT(Table[Opportunity]), [Total Count Product Groups] = 2))

 

To get a table with all the counts, you can make a calculated table of numbers called "Count" with GENERATESERIES(1, 10, 1) for example and use that in a visual, and then use SELECTEDVALUE(Counts[Value]) in place of 2 above.

 

 

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

3 REPLIES 3
Levo_242
New Member

Hi Pat,

 

thanks it works!

 

Thanks for your support!

Anonymous
Not applicable

Hi @Levo_242 ,

Could you please mark the helpful post as Answered since your problem has been resolved? It will help other members in the community find the solution easily if they face the similar problem with you. Thank you.
Best Regards
Community Support Team _ Rena Ruan
If this post helps, then please consider Accept it as the solution to help the other members find it more.

mahoneypat
Microsoft Employee
Microsoft Employee

You can use this to get the count of those with 2, for example.

 

Opps with 2 = COUNTROWS(FILTER(DISTINCT(Table[Opportunity]), [Total Count Product Groups] = 2))

 

To get a table with all the counts, you can make a calculated table of numbers called "Count" with GENERATESERIES(1, 10, 1) for example and use that in a visual, and then use SELECTEDVALUE(Counts[Value]) in place of 2 above.

 

 

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.