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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
ADA371
New Member

Affect ramdom value in new colum from an existing list

Hi all,

 

I come to you because i have a big problem and i don't have any solution after many hours of searching on the web. 
Here is my problem:

=> I want to attribute radomly a value from an other table in a column

The MCD:

ADA371_1-1698396442513.png

 

The currently reporting:

ADA371_0-1698396383942.png

 

The wanted result for the grid is only 3 lines (not 6 with duplicate):

- F2318,PRIVILEGES,Name16,FF6949

- F2318,PRIVILEGES,Name26,FF6959

- F2318,PRIVILEGES,Name6,FF6949

 

The repartition of Code_Promo can be different but i want them ramdom from the list "Code Promo" filtered. 

 

Thank you very much !!!

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @ADA371 ,

 

My Sample is as below and I can reproduce your issue.

Ref_Havea_Promo:

vrzhoumsft_0-1698823826482.png

Client:

vrzhoumsft_1-1698823833202.png

Relationship:

vrzhoumsft_2-1698823866905.png

vrzhoumsft_3-1698823954831.png

I think your issue is caused by data model. If you want to get data without duplicate, I think there should be more conditons in two tables. According to your statement, I think there should be a unique column in both tables like [Date] to determind which name is connected to which Code_Promo.

New Table looks like as below.

Ref_Havea_Promo:

vrzhoumsft_4-1698824353434.png

Client:

vrzhoumsft_5-1698824368676.png

vrzhoumsft_6-1698824398881.png

Measure:

 

 

Measure = CALCULATE(MAX(Ref_Havea_Promo[Code_Promo]),FILTER(Ref_Havea_Promo,Ref_Havea_Promo[Date] = MAX(Client[Date])))

 

 

Result is as below.

vrzhoumsft_7-1698824432964.png

 

Best Regards,
Rico Zhou

 

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

Hi @ADA371 ,

 

My Sample is as below and I can reproduce your issue.

Ref_Havea_Promo:

vrzhoumsft_0-1698823826482.png

Client:

vrzhoumsft_1-1698823833202.png

Relationship:

vrzhoumsft_2-1698823866905.png

vrzhoumsft_3-1698823954831.png

I think your issue is caused by data model. If you want to get data without duplicate, I think there should be more conditons in two tables. According to your statement, I think there should be a unique column in both tables like [Date] to determind which name is connected to which Code_Promo.

New Table looks like as below.

Ref_Havea_Promo:

vrzhoumsft_4-1698824353434.png

Client:

vrzhoumsft_5-1698824368676.png

vrzhoumsft_6-1698824398881.png

Measure:

 

 

Measure = CALCULATE(MAX(Ref_Havea_Promo[Code_Promo]),FILTER(Ref_Havea_Promo,Ref_Havea_Promo[Date] = MAX(Client[Date])))

 

 

Result is as below.

vrzhoumsft_7-1698824432964.png

 

Best Regards,
Rico Zhou

 

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

lbendlin
Super User
Super User

Let's say you have five promos.  Add a column to the Client table with a random number between 1 and 5 (or 0 and 4)  and then lookup the corresponding promo. 

 

Do not actively join the tables. (inactive relationship is ok).

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.