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

Changing multiple row names

I have a table as below: 

CountryCostPercentage
Africa pacific region1k95%
Asia Region2k96%
Europe Region3k97%
Latin America Region4k98%

 

Here i want to change the country column fileds as like below : 

CountryCostPercentage
AFR1k95%
ASR2k96%
EUR3k97%
LAR4k98%

 

Can someone please with this.

Thanks in advance.

1 ACCEPTED SOLUTION
Icey
Community Support
Community Support

Hi @Sambidha ,

 

You can try to create a calculated column like so:

Column =
VAR LastWord =
    TRIM (
        RIGHT (
            SUBSTITUTE ( [Country], " ", REPT ( " ", LEN ( [Country] ) ) ),
            LEN ( [Country] )
        )
    )
RETURN
    UPPER ( LEFT ( [Country], 2 ) & LEFT ( LastWord, 1 ) )

country.JPG

 

 

Best regards

Icey

 

If this post helps,then consider Accepting it as the solution to help other members find it faster.

View solution in original post

5 REPLIES 5
Icey
Community Support
Community Support

Hi @Sambidha ,

 

You can try to create a calculated column like so:

Column =
VAR LastWord =
    TRIM (
        RIGHT (
            SUBSTITUTE ( [Country], " ", REPT ( " ", LEN ( [Country] ) ) ),
            LEN ( [Country] )
        )
    )
RETURN
    UPPER ( LEFT ( [Country], 2 ) & LEFT ( LastWord, 1 ) )

country.JPG

 

 

Best regards

Icey

 

If this post helps,then consider Accepting it as the solution to help other members find it faster.

Daviejoe
Memorable Member
Memorable Member

Let me know if this helps (also, be mindful that Replace Values is case sensitive)

 

Replace Values.png





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

Proud to be a Super User!




Daviejoe
Memorable Member
Memorable Member

There are a couple ways of doing this.

 

If you go into Power Query, in the Transform tab, replace values and replace the longer names entirely with the abbreviations.

 

Or you create a table that has the current names with a new column added to house the abbreviations and then you have this as a linked Dimension table.

 

 





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

Proud to be a Super User!




Hi,

Can you please help me with the query.

Thanks.

Of course, give me five mins and I'll have a step through ready for you





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

Proud to be a Super User!




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.