Forum Discussion
Replace values
Hi,
Background
I have two spreadsheets. Table 1 is a 'master' document and table 2 is a change log that records any changes to the master document.
All rows have a unique code number that links the two spreadsheets. E.g. If there is a R01 in the master document changes will be recorded in the change log next to R01.
Problem
I am able to identify through DAX expression whether there is any changes recorded in the change log but need to be able to replace the values in 'master document' with the changes recorded in the change log.
E.g. if the risk description in table 1 is changed in table 2 I need a forumla that identifies 1.) there is a change, and 2.) that the risk description in table 1 should reflect that change
if you created relationship between two tables you can try this
Column = if(RELATED('Table 2'[Risk description change])="",'Table 1'[Risk description],RELATED('Table 2'[Risk description change]))if don't have the relationship, you can try thisColumn 2 =var _update=maxx(FILTER('Table 2','Table 1'[Risk ID]='Table 2'[Risk ID ]),'Table 2'[Risk description change])return if(_update="",'Table 1'[Risk description],_update)pls see the attachment belowyou are welcome
9 Replies
- ryan_mayuSuper User
Anonymous
could you pls provide the sample data(not the table visual) of the two tables that you mentioned and the expected output?
- AnonymousNot applicable
Table 1
Risk ID Risk description R01 There is a risk that the puppy won't have a nice temperment R02 There is a risk that the puppy will make a mess R03 There is a risk that the puppy will chew expensive shoes R04 There is a risk that the puppy won't be potty trained R05 There is a risk that the puppy won't be able to be trained Table 2
Risk ID Risk description change R01 Cavoodle puppy might not have a nice temperment - ryan_mayuSuper User
what's the definition of change?
We have records in table 2?
why in your screenshot , the status of R02 is also change?
- AnonymousNot applicable
Sorry this just gives lots of errors. Can you recommend a DAX code?
- ryan_mayuSuper User
if you created relationship between two tables you can try this
Column = if(RELATED('Table 2'[Risk description change])="",'Table 1'[Risk description],RELATED('Table 2'[Risk description change]))if don't have the relationship, you can try thisColumn 2 =var _update=maxx(FILTER('Table 2','Table 1'[Risk ID]='Table 2'[Risk ID ]),'Table 2'[Risk description change])return if(_update="",'Table 1'[Risk description],_update)pls see the attachment below- AnonymousNot applicable
This works great-thank you