Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
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
Solved! Go to Solution.
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
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsNow it worked. I had to remove the space after the "
🙂
Well it actually did not 😞 hehe. It copied the column exactly as it was, it did not make the changes 😞
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
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHi,
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
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsUser | Count |
---|---|
127 | |
108 | |
99 | |
63 | |
62 |
User | Count |
---|---|
136 | |
113 | |
102 | |
71 | |
60 |