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

Swap values in the same row between two columns

Hello,

Is it possible to swap values in two columns for the same row?  For example; Row 10-Column A and Row 10-Column B need to have the values swapped.

 

NOTE:  All other values in these columns are correct.  For some reason, these two particular values must have been entered incorrectly in the source data.

 

Any help would be appreciated

1 ACCEPTED SOLUTION
Zubair_Muhammad
Community Champion
Community Champion

Hi @Anonymous

 

First Add an Index Column from the Query Editor to identify row number

 

then you can use this Custom Column to get revised Column Values with swapped rows

 

if [Index]=10 then [Col B] else [Col A])

swap.png

 


Regards
Zubair

Please try my custom visuals

View solution in original post

3 REPLIES 3
Zubair_Muhammad
Community Champion
Community Champion

Hi @Anonymous

 

First Add an Index Column from the Query Editor to identify row number

 

then you can use this Custom Column to get revised Column Values with swapped rows

 

if [Index]=10 then [Col B] else [Col A])

swap.png

 


Regards
Zubair

Please try my custom visuals

@Anonymous

 

Please see Query Editor in attached file

 

 


Regards
Zubair

Please try my custom visuals
Anonymous
Not applicable

Thanks Zubair.  That worked very nicely.  I actually had the ID already inserted but wasn't connecting the dots enough to think of a conditional column like that.  For the record, I actually had a couple of incorrect values to change.  I also added a second column to complete the swap.  I've included some notes in case somSwapping values.JPGeone has a similar problem in the future.

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.