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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Priyadar_V1
New Member

How to divide values into 'N' number of groups

Hi. I am new to powerbi. I have a column with different value and the range of these number changes. I am trying to catergories the column into 10 scales . This could be done using if statements but I feel it is not the right way to do it.  Example of my data set -(I have divided the data into three scales)

 

salesrank
41
62
31
103
83
52

 

I have done this calculation in excel using the formula (excel - Dividing a column into N equal groups by value - Stack Overflow)

=MAX(ROUNDUP(PERCENTRANK([Range],[OneCellOfTheRange]) *[NumberOfBuckets],0),1)

I am trying to do the same in powerbi.  Thank you in advance

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

Hi @Priyadar_V1 ,

According to your description, here's my solution. Create a calculated column.

Column =
VAR _Rank =
    RANKX ( 'Table', 'Table'[sales],, ASC )
VAR _Range = 3
VAR _Rows =
    COUNTROWS ( 'Table' )
RETURN
    ROUNDUP ( DIVIDE ( _Rank, DIVIDE ( _Rows, _Range ) ), 0 )

Get the correct result.

vkalyjmsft_0-1667269353624.png

You can manually modify the variable _Range per your need.

You can also learn about binning in Power BI, which is a way to group based on the value of the column.

 

I attach my sample below for your reference.

Best Regards,
Community Support Team _ kalyj

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

2 REPLIES 2
v-yanjiang-msft
Community Support
Community Support

Hi @Priyadar_V1 ,

According to your description, here's my solution. Create a calculated column.

Column =
VAR _Rank =
    RANKX ( 'Table', 'Table'[sales],, ASC )
VAR _Range = 3
VAR _Rows =
    COUNTROWS ( 'Table' )
RETURN
    ROUNDUP ( DIVIDE ( _Rank, DIVIDE ( _Rows, _Range ) ), 0 )

Get the correct result.

vkalyjmsft_0-1667269353624.png

You can manually modify the variable _Range per your need.

You can also learn about binning in Power BI, which is a way to group based on the value of the column.

 

I attach my sample below for your reference.

Best Regards,
Community Support Team _ kalyj

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

Thank you so much 🙂

 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.