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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
kkalyanrr
Helper V
Helper V

Distribute a value unevenly across different rows based on rank

Hello Team,

I'm trying to achieve the below expected result,Please guide.
I need to distribute X column across all the Names un evenly, least rank gets highest value and highest rank gets lowest value.

NameOverallXRank(Based on Overall)Z
A1555122
B1855215
C2055310
D225545
E255552
F285561

 

Thanks.

kkalyanrr_0-1648747787219.png

 

1 ACCEPTED SOLUTION
Icey
Community Support
Community Support

Hi @kkalyanrr ,

 

How about this?

 

1. Create a calculated table.

Rand Table = 
VAR RowNum_ =
    COUNTROWS ( 'Table' )
RETURN
    ADDCOLUMNS ( GENERATESERIES ( 1, RowNum_, 1 ), "Rand", RAND () )

Icey_0-1649152037988.png

 

2. Add "Modified Rand" and "Rank" column in the "Rand Table".

Modified Rand = 
MAX ( 'Table'[X] ) / SUM ( 'Rand Table'[Rand] ) * [Rand]
Rank =
RANKX ( 'Rand Table', [Modified Rand],, DESC, DENSE )

Icey_1-1649152058213.png

 

3. Create "Modified Rand" column in your table.

Modified Rand = 
LOOKUPVALUE (
    'Rand Table'[Modified Rand],
    'Rand Table'[Rank], 'Table'[Rank(Based on Overall)]
)

Icey_2-1649152074184.png

 

4. Hide the "Rand Table".

Icey_3-1649152129440.png

 

5. You can find that the total is 55 and the Modified Rand column is sorted.

Icey_4-1649152180852.png

 

 

Best Regards,

Icey

 

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
Icey
Community Support
Community Support

Hi @kkalyanrr ,

 

How about this?

 

1. Create a calculated table.

Rand Table = 
VAR RowNum_ =
    COUNTROWS ( 'Table' )
RETURN
    ADDCOLUMNS ( GENERATESERIES ( 1, RowNum_, 1 ), "Rand", RAND () )

Icey_0-1649152037988.png

 

2. Add "Modified Rand" and "Rank" column in the "Rand Table".

Modified Rand = 
MAX ( 'Table'[X] ) / SUM ( 'Rand Table'[Rand] ) * [Rand]
Rank =
RANKX ( 'Rand Table', [Modified Rand],, DESC, DENSE )

Icey_1-1649152058213.png

 

3. Create "Modified Rand" column in your table.

Modified Rand = 
LOOKUPVALUE (
    'Rand Table'[Modified Rand],
    'Rand Table'[Rank], 'Table'[Rank(Based on Overall)]
)

Icey_2-1649152074184.png

 

4. Hide the "Rand Table".

Icey_3-1649152129440.png

 

5. You can find that the total is 55 and the Modified Rand column is sorted.

Icey_4-1649152180852.png

 

 

Best Regards,

Icey

 

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

kkalyanrr
Helper V
Helper V

@selimovd - Thanks for the quick response.

these 22,15 are few random numbers..basically that 55 should be distributed across the no of rows (in this case 6 rows..it may be 10 rows or 12 rows)...
the highest rank should get least number and the lowest get highst number..thats the logic I'm expecting.

 

selimovd
Super User
Super User

Hello @kkalyanrr ,

 

can you give more information about the mechanism how the points are distributed?

Does the first always get 22? Is it always 22, 15, ... 1? What if there are 7 or 8 instead of 6 rows? Give some more information and we can help you.

 

Best regards

Denis

@selimovd 

Its just random sampling...the only point is the highest rank should get lowest value and lowest rank should get highest value..

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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