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
benmcmahon
Helper II
Helper II

Getting the middle segment of Customers.

Hello,

 

I have come across a problem where I am trying to segment my customer data based on another field (samples Submitted in this case), into top 20%; 40-80% and bottom 40% of customers. PowerBI only alows for getting top and bottom 'N', not the middle.

 

Is there a way for me to get the middle segment using DAX?

Screenshot 2022-10-07 123338.png

This is the final result I am looking for, but with the middle 40% as well.

 

All help is apprecaited.

 

Thanks.

1 ACCEPTED SOLUTION
v-chenwuz-msft
Community Support
Community Support

Hi @benmcmahon ,

 

Maybe you can refer the follwoing measure to do that:

Measure = 
var _s = SUMMARIZE(ALLSELECTED('Table'),[id],"sum",SUM('Table'[values]))
var _1 = PERCENTILEX.INC(_s,[sum],0.2)
var _2 = PERCENTILEX.INC(_s,[sum],0.6)
var _20_60 = CALCULATETABLE(VALUES('Table'[id]),FILTER(_s,[sum]>=_1&&[sum]<=_2))
return
CALCULATE(COUNT('Table'[id]),FILTER('Table',[id] in _20_60))

 

Pbix in the end you can refer.

Best Regards

Community Support Team _ chenwu zhu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-chenwuz-msft
Community Support
Community Support

Hi @benmcmahon ,

 

Maybe you can refer the follwoing measure to do that:

Measure = 
var _s = SUMMARIZE(ALLSELECTED('Table'),[id],"sum",SUM('Table'[values]))
var _1 = PERCENTILEX.INC(_s,[sum],0.2)
var _2 = PERCENTILEX.INC(_s,[sum],0.6)
var _20_60 = CALCULATETABLE(VALUES('Table'[id]),FILTER(_s,[sum]>=_1&&[sum]<=_2))
return
CALCULATE(COUNT('Table'[id]),FILTER('Table',[id] in _20_60))

 

Pbix in the end you can refer.

Best Regards

Community Support Team _ chenwu zhu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you very much, this appears to work well for segmenting my customer base.

 

I have one question though, I have a tables showing the same data that my charts do, using the same tables and report wide filters, they do not show the same number as the table when adding up the segments for each month.

 

I have attached my Pbix files, the 'client stats summary' and 'agent stats summary' pages are made up of the samedata from the same tables (AgentUKSampleCount & ClientUKSampleCount).

 

Can anyone help with why this is happening?Screenshot 2022-10-13 163748.pngScreenshot 2022-10-13 163859.pngScreenshot 2022-10-13 164127.pngScreenshot 2022-10-13 164225.pnghttps://techiongrouplimited-my.sharepoint.com/:u:/g/personal/ben_techiongroup_co_nz/ET6BNpl-cllMlGoC... 

Still looking for any help with this if possible.

amitchandak
Super User
Super User

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.