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
Anonymous
Not applicable

Percentage segmentation ok %column

Hi,

 

I have query with % in column and I would like to creage segmentation like upper 20% mid 20-80% low 80-20%

 

this is example of query  where I would like to add another column with the segmentation

GurusCZ_0-1645792809797.png

to this 

GurusCZ_1-1645792881176.png

 

I guess I could use DAX but I am not sure how in this case.

 

thank you a lot.

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

Hi  @Anonymous ,

I created some data:

vyangliumsft_0-1646617253810.png

Here are the steps you can follow:

1. Add Column Index Column From 1.

vyangliumsft_1-1646617253813.png

2. Create calculated column.

%per =
CALCULATE(SUM('Table'[% column]),FILTER(ALL('Table'),'Table'[Index]<=EARLIER('Table'[Index])))
Segementation =
var _highestvalue=100
var _20per=_highestvalue * 0.002
var _20per80per=_highestvalue * 0.008
return
SWITCH(TRUE(),
'Table'[%per] <=_20per,"UPPER 20%",
'Table'[%per] >_20per&&'Table'[%per]<=_20per80per,"MIDDLE 80-20%",
"low 80-20%")

3. Result:

vyangliumsft_2-1646617253814.png

 

Best Regards,

Liu Yang

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

7 REPLIES 7
v-yangliu-msft
Community Support
Community Support

Hi  @Anonymous ,

I created some data:

vyangliumsft_0-1646617253810.png

Here are the steps you can follow:

1. Add Column Index Column From 1.

vyangliumsft_1-1646617253813.png

2. Create calculated column.

%per =
CALCULATE(SUM('Table'[% column]),FILTER(ALL('Table'),'Table'[Index]<=EARLIER('Table'[Index])))
Segementation =
var _highestvalue=100
var _20per=_highestvalue * 0.002
var _20per80per=_highestvalue * 0.008
return
SWITCH(TRUE(),
'Table'[%per] <=_20per,"UPPER 20%",
'Table'[%per] >_20per&&'Table'[%per]<=_20per80per,"MIDDLE 80-20%",
"low 80-20%")

3. Result:

vyangliumsft_2-1646617253814.png

 

Best Regards,

Liu Yang

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

 

Anonymous
Not applicable

omg you are best, thank you a lot. It works like charm

v-yangliu-msft
Community Support
Community Support

Hi  @Anonymous ,

 

Not very clear what you mean.... can you express your expected results in the form of pictures, we can help you better.

 

Best Regards,

Liu Yang

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

Anonymous
Not applicable

Hi Liu, 

below is the picture I hope this will help to understand me more? 

GurusCZ_0-1646389889001.png

 

v-yangliu-msft
Community Support
Community Support

Hi  @Anonymous ,

Here are the steps you can follow:

1. Create calculated column.

Segementation =
SWITCH(
    TRUE(),
    'Table'[% column] <=0.01,"Mid 20-80%",
    'Table'[% column] >0.01&&'Table'[% column]<=0.2,"upper 20%",
    "low 80-20%"
)

2. Result:

vyangliumsft_0-1646102867616.png

 

Best Regards,

Liu Yang

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

Anonymous
Not applicable

Hi Liu,

 

thanks a lost. The problem in my  case is that I need to sum up the % to get the upper 20% so lets say I have 20 lines with 1% result and that would be the upper 20% and then the rest would be 20-80% but again as sum. let me know if it make sense? 

VahidDM
Super User
Super User

Hi @Anonymous 

 

How do you want to assign segmentation code to the data? any calculated?

 


Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

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.