cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
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
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

Super User I
Super User I

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!




Super User I
Super User I

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
secondImage

Congratulations!

We are excited to announce the Power BI Super Users!

Wave Release 2

Check out the updates in Power BI.

Overview of Power BI 2020 release wave 2!

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

secondImage

The largest Power BI virtual conference

100+ sessions, 100+ speakers, Product managers, MVPs, and experts. All about Power BI. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors