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
refint650
Helper II
Helper II

Replace values from column1 to another using dax

 

Hello All

 

How to write expression in a dax to replace employee record historical vlaue with current value for department & role.  In General when people change org or department or they get promoted these scenarios come across how do we handle  them in expression.

 

 

1) if "Prior dept" column is blank or null or unmapped  values then  replace value from "Emp Dept" else Prior Dept

2) If Prior Role is blank or null  value then replace value from Emp role else "Prior Role

 

Thanks

Vs

 

refint650_0-1708548554749.png

 

1 ACCEPTED SOLUTION
v-huijiey-msft
Community Support
Community Support

Hi @refint650 ,

 

Hope all is going well.

 

Please follow these steps:

 

1. This is the original data I created:

vhuijieymsft_0-1708592744203.png

 

2. To achieve your needs, I created two calculated columns, the DAX syntax is as follows:

Calculated Dept =
IF('Table1'[Prior Dept] = blank() || [Prior Dept] = "unmapped",'Table1'[Emp Dept],'Table1'[Prior Dept])

Calculated Role=
IF('Table1'[Prior Role] = blank() || [Prior Role] = "unmapped",'Table1'[Emp Role],'Table1'[Prior Role])

 

3. Drag them to the report page for display. The effect is as follows:

vhuijieymsft_1-1708592744206.png

 

pbix file is attached.

 

If you have any further questions please feel free to contact me.

 

Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

View solution in original post

2 REPLIES 2
v-huijiey-msft
Community Support
Community Support

Hi @refint650 ,

 

Hope all is going well.

 

Please follow these steps:

 

1. This is the original data I created:

vhuijieymsft_0-1708592744203.png

 

2. To achieve your needs, I created two calculated columns, the DAX syntax is as follows:

Calculated Dept =
IF('Table1'[Prior Dept] = blank() || [Prior Dept] = "unmapped",'Table1'[Emp Dept],'Table1'[Prior Dept])

Calculated Role=
IF('Table1'[Prior Role] = blank() || [Prior Role] = "unmapped",'Table1'[Emp Role],'Table1'[Prior Role])

 

3. Drag them to the report page for display. The effect is as follows:

vhuijieymsft_1-1708592744206.png

 

pbix file is attached.

 

If you have any further questions please feel free to contact me.

 

Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

lbendlin
Super User
Super User

You cannot replace/modify column values with DAX. Best you can do is add another calculated column.

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.