cancel
Showing results for 
Search instead for 
Did you mean: 
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
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power BI Dev Camp Session 23 768x460.jpg

Check it Out!

Mark your calendars and join us on Thursday, June 30 at 11a PDT for a great session with Ted Pattison!

Top Solution Authors
Top Kudoed Authors