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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
filipe197
Frequent Visitor

Count distinct values of a column grouped by another column

Hello guys,

 

I need to calculate the client loading (distinct products) grouping it in the different profile segments. I did try first to create a measure like distinct number of products/distinct number of clients but obviously it is not enough because this has to calculate the distinct number of products by each client number and then summarize it before divide for the number of clients. Does any know hou to pull this off?? Example:foto pbi.JPG

 

 

 Like the example above,  the formula should be: Cliente Loading = number of products/mumber of clients an so then the results by profile segment are:

 

 

Profile SegmentClient Loading
Total13/5 = 2,6
Target6/3 = 2
Non Target7/2 = 3,5

 

Thanks in advance for the help.

1 ACCEPTED SOLUTION

Hi @filipe197,

 

Here are the formulas i wrote

 

Clients=CALCULATE(MIN(Data[Value]),Data[Attribute]<>"Current Price")

Products=DISTINCTCOUNT(Folha3[Product])

Client Loading=[Products]/[Clients]

 

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hi @filipe197,

 

If you share some sample data/pbix file, it will help for us to clarify your scenario and do some test.

How to Get Your Question Answered Quickly

 

Regards,

Xiaoxin Sheng

Hello @Anonymous

 

I have replicated the example in a pbix file:

https://we.tl/PEILLkDdmX

 

It's all about solving what i shared in my first post, which i am not figuring out how to do so.

 

Thanks a lot,

Filipe

Hi @filipe197,

 

Here are the formulas i wrote

 

Clients=CALCULATE(MIN(Data[Value]),Data[Attribute]<>"Current Price")

Products=DISTINCTCOUNT(Folha3[Product])

Client Loading=[Products]/[Clients]

 

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hello @Ashish_Mathur 

 

About your formula of Products, the ideia is to calculate the distinct products but by each client, so for target it should be 6 and for non-target it should bem 7. Let's see:
For the target we have client 123456789 which have 2 distinct products (A+B), client 125632444 which have 3 distinct products (A+B+C), and client 145320028 which have 1 distinct product (B). So the total distinct products of target by client is 2+3+1 = 6.
Can you do this?

 

Thanks,

filipe197

 

 

 

 

Hi,

 

The formula for Products should be:

 

=SUMX(SUMMARIZE(Folha3,Folha3[Client number],"ABCD",DISTINCTCOUNT(Folha3[Product])),[ABCD])

 

Hope this helps.

 

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 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.

Top Solution Authors
Top Kudoed Authors