Reply
garrettmindrup
Frequent Visitor
Partially syndicated - Outbound

Assign Random Number For Each Distinct Item

Hello, 

I have a table with document numbers and $ amounts. Some document numbers have multiple amounts, so those numbers repeat within the table. 
I'd like to assign random numbers to each distinct document number. Is there a way to do a FOREACH() type formula that will assign the RAND() function to each distinct value in my document number column? 

Example Output:

Rand()Doc Number$ Amount
.9921100
.992189
.87622000
.653341
.6533200
1 ACCEPTED SOLUTION
garrettmindrup
Frequent Visitor

Syndicated - Outbound

I think my solution is to pull in the document numbers into a separate table, remove duplicates, assign random numbers, and then create a relationship between the distinct table and the table with duplicates. Still open to other ideas if someone has a better solution. 

View solution in original post

2 REPLIES 2
garrettmindrup
Frequent Visitor

Syndicated - Outbound

I think my solution is to pull in the document numbers into a separate table, remove duplicates, assign random numbers, and then create a relationship between the distinct table and the table with duplicates. Still open to other ideas if someone has a better solution. 

garrettmindrup
Frequent Visitor

Syndicated - Outbound

Bump

avatar user

Helpful resources

Announcements
March PBI video - carousel

Power BI Monthly Update - March 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors (Last Month)
Top Kudoed Authors (Last Month)