Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.
Check it out now!Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more
Hello,
I am looking to creata a customer column by grouping values of that column and creating a new field. Below is what I am trying to get-
Current Values in the field | Expected Values in the field | |
Country | Country_CUSTOM | |
USA | USA | |
JAPAN | JAPAN | |
CHINA | Others | |
INDIA | ||
UK | ||
I have a field called Country which has 5 values. I want to create a custom field with 2 values(USA and JAPAN) as is and club remaining 3 as OTHERS.
I would appreciate the suggestions on how to get this.
TIA
AP.
Solved! Go to Solution.
In that case your calculated column should look like this...
Country_CUSTOM_2 =
SWITCH(
TRUE(),
[Country] IN {"USA", "JAPAN", "CHINA"}, [Country],
"OTHERS"
)
In this version you can add countries to the list as you wish and all other countries not listed will be "Others".
Proud to be a Super User! | |
hi @Anupal
There are many ways to group in power BI
Prefer Power Query
Otherwise, have you tried Power BI DM > Data Group?
A calculated column with the following should work.
Country_CUSTOM =
SWITCH(
TRUE(),
OR([Country] = "USA", [Country] = "Japan"), [Country],
"OTHERS"
)
Proud to be a Super User! | |
Hello @jgeddes , thanks for the solution,.
However I have a question, does the above logic works only on 2 values?
For Eg: If I have to show 3 countries (USA,JAPAN,CHINA) and rest 2 countries as OTHERS..then also the same will work?
In that case your calculated column should look like this...
Country_CUSTOM_2 =
SWITCH(
TRUE(),
[Country] IN {"USA", "JAPAN", "CHINA"}, [Country],
"OTHERS"
)
In this version you can add countries to the list as you wish and all other countries not listed will be "Others".
Proud to be a Super User! | |