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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Anonymous
Not applicable

Creating a Custom column based on Value from one column

Hi Guys,

 

I am just starting off in Power BI, i have following query.

I want to create custom column based on the values in another coumn of the same table.

For example, if Orignal Column contains value ABC cont or ABC Holding  then it should come to custom column as ABC ans so on for other values in original column who meets the criteria.

 

Original ColumnCustom Group
ele HealthcareEST
HIGHNESSPAH
PAHPAH
ABC ContABC
ABC Holding ABC
EST HoldingEST

 

Regards

1 ACCEPTED SOLUTION
NHarington
Frequent Visitor

Hello, 

 

By creating a custom column in powerBI and pasting the following dax query, you will return what you are looking for. (Note that you will need to add more rows for each of your conditions. 

 

NewColumn =
SWITCH(
    TRUE(),
    SEARCH("ABC", [OriginalColumn], 1, 0) > 0, "ABC",
    SEARCH("EST", [OriginalColumn], 1, 0) > 0, "EST",
    BLANK()  -- Or you can add another condition here if needed by simply repeating the above lines
)

 

 Please mark my answer as the solution if this works for you, feel free to respond if you need more clarification!

 

Have a great day

View solution in original post

4 REPLIES 4
suparnababu8
Super User
Super User

Hi @Anonymous 

 

I think for first two rows, it's not possible in Power BI. If we exclude first two rows, then we can do it by using Power Query Editor.

 

There is option called Column from examples.  If you use that, you'll get the expected out put. 
Step-1

suparnababu8_0-1725451069633.png

Select the  Original Column->Addcolumn in top ribbon bar->Click on column from examples(highlighted in yellow)

Step-2
After clicking on column from examples you able to see below picture

suparnababu8_2-1725451298650.png

If you type first 3 letter, then hit enter button, you'll get automaticall all values as expected. Then click ok on above the first characters column.

 

Step-3

suparnababu8_3-1725451419686.png

The just you'll rename the  first characters column as Custom Group.

 

Thanks!

 

NHarington
Frequent Visitor

Hello, 

 

By creating a custom column in powerBI and pasting the following dax query, you will return what you are looking for. (Note that you will need to add more rows for each of your conditions. 

 

NewColumn =
SWITCH(
    TRUE(),
    SEARCH("ABC", [OriginalColumn], 1, 0) > 0, "ABC",
    SEARCH("EST", [OriginalColumn], 1, 0) > 0, "EST",
    BLANK()  -- Or you can add another condition here if needed by simply repeating the above lines
)

 

 Please mark my answer as the solution if this works for you, feel free to respond if you need more clarification!

 

Have a great day

Shivu-2000
Super User
Super User

Hi @Anonymous 

For last 4 entry according to your table you can use.
https://learn.microsoft.com/en-us/power-bi/create-reports/desktop-add-column-from-example

https://www.youtube.com/watch?v=BSmmNgO_EOU

And I didnt understand your requirement for starting 2 entries like whats the relation, Can you explain those.

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Happy to help!

Anonymous
Not applicable

Hi thanks for reply

 

Acyually the first coloumn (original coloumn) is company name and second coulmn (custom column) is group name. 

i want build a custom coulumn based on which compnay falls under which group.

 

Thanks

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.