Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Change the names of a column for different names

Hi!

 

I have a column that contains the name of different departments. There are two names though that I would like to be shown with a different name and to change them in the database (origin) it might be more difficult.

Is it possible with a Dax function or an "if" or something to create a new column that shows the name of the departments, with a different new name for three of them:

 

For eample:

 

one column has:                              New column:

 

Finance                                            Finance 2020

Controlling                                      Controlling

IT                                                     Information Technology

Legal                                               Legal international

Marketing                                       Marketing

HR                                                  HR

Product                                           Product

International                                   International

 

Is that possible? Which function should I use?

 

Thanks so much,

JFB

 

 

2 ACCEPTED SOLUTIONS

Not sure without the error code but can be the use of dot comma instead of comma try this:

 

Department Name =
SWITCH (
    [Department],
    " Resolve (italy)", " Italy-Resolve ",
    " Claims (EN)", " UK-Claims (EN)",
    " Customer Relations (EN)", " UK-Customer Relations (EN)",
    [Department]
)

 

If it does not work can you share the error code please.


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

Anonymous
Not applicable

Now it worked. I had to remove the space after the "

 

🙂

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Now it worked. I had to remove the space after the "

 

🙂

Anonymous
Not applicable

Well it actually did not 😞 hehe. It copied the column exactly as it was, it did not make the changes 😞

MFelix
Super User
Super User

Hi @Anonymous ,

 

You can create that in DAX or M Language.

 

In the query editor add the following code:

if [Column1] = "Finance" then "Finance 2020" else
  if [Column1]= "IT" then "Information Techology"
else if [Column1] = "Legal" then "Legal International"
else [Column1]

 

In dax add the following:

Column = SWITCH( [Column1] ;"Finance";  "Finance 2020";
 "IT" ; "Information Techology";
"Legal"; "Legal International";
[Column1])

 


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



Anonymous
Not applicable

Hi,

it gives me error

Department Name = SWITCH( [Department] ;" Resolve (italy)"; " Italy-Resolve "; " Claims (EN)" ; " UK-Claims (EN)"; " Customer Relations (EN)"; " UK-Customer Relations (EN)"; [Department])

what is wrong there?

Thx

Not sure without the error code but can be the use of dot comma instead of comma try this:

 

Department Name =
SWITCH (
    [Department],
    " Resolve (italy)", " Italy-Resolve ",
    " Claims (EN)", " UK-Claims (EN)",
    " Customer Relations (EN)", " UK-Customer Relations (EN)",
    [Department]
)

 

If it does not work can you share the error code please.


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.