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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Employee
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!

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.

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
mahoneypat
Employee
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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.