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
Cazz963
New Member

Replace, substitution value in column for another in same column based on another columns value

Hi

New to Power Bi.

 

I have the following extract from a table

 

Product code        Type                      Source             

B1wp2XXXX1       pre-process              J15

b1wp2XXXX1        post-process            GKV 1

b1wp2XXXX2       pre-process              j2

b1wp2XXXX2       post-process             GKV 2

B3WP2XXXX1      pre-process              j6

b3WP2XXXX1      post-process             GKV 9

etc.....

 

So a "product code" has various "types" of process and "source". What I am after is a solution to change the "source" of the "pre-process" to corresponding "post-process" one for that product code ie for b1wp2xxxx1  J15 to GKV.

 

Tried various formulas, workarounds etc with no joy.

 

Thanks

 

R

2 REPLIES 2
ValtteriN
Super User
Super User

Hi,

Here is how to do this with a measure:

Source measure = CALCULATE(MAX(Process[Source]),ALLEXCEPT(Process,Process[Product code]),Process[Type]="post-process")
ValtteriN_0-1642949364863.png

 

Ping me with @ if you want to do this with calculated column or powerquery.

I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

 




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hi Valtteri,

Thanks for the reply.

I maybe made the sample above too simple as there are many "types" to be considered and "sources"

After typing in the measure i get the error "A single value for column 'Source' in table xxxxx cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, mac, count, or sum to get a single result"

 

Thanks again

R

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.

Top Solution Authors