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
NeroX
Helper I
Helper I

add a column with the region to the seller

Hello,

 

I have excel with Salesman:

NeroX_0-1682598376494.png

and I need to add a region to the salesman but no in excel.

NeroX_1-1682598433293.png

I want add regions to the salesman in Data wiew.

NeroX_3-1682598698141.png

What can i do? Any ideas?

 

PS: i can't use the query editor because excel will always be uploaded new and my column would be canceled, but when i create it in data wiev it stays there.

 

Thank you. 🙂

 

1 ACCEPTED SOLUTION
BA_Pete
Super User
Super User

Hi @NeroX ,

 

Query Editor in Power BI will work fine. It will add the custom column after the new Excel has been imported each time. Either way, you want to create a conditional column:

 

In Power Query:

 

if List.Contains( {"aadamek", "adomanski"}, [Salesman] ) then "CEE"
else if List.Contains( {"adous", "jim", "jane"}, [Salesman] ) then "GER"
else if ...
...
else // your escape value here e.g. null, "No Region" etc.

 

 

In DAX:

 

SWITCH(
    TRUE(),
    yourTable[Salesman] IN {"aadamek", "adomanski"}, "CEE",
    yourTable[Salesman] IN {"adous", "jim", "jane"}, "GER",
    ...,
    ...,
    // your escape value here e.g. "No Region" etc.
    // you can ignore this last argument if you want the escape to be BLANK()
)

 

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




View solution in original post

3 REPLIES 3
BA_Pete
Super User
Super User

Hi @NeroX ,

 

Query Editor in Power BI will work fine. It will add the custom column after the new Excel has been imported each time. Either way, you want to create a conditional column:

 

In Power Query:

 

if List.Contains( {"aadamek", "adomanski"}, [Salesman] ) then "CEE"
else if List.Contains( {"adous", "jim", "jane"}, [Salesman] ) then "GER"
else if ...
...
else // your escape value here e.g. null, "No Region" etc.

 

 

In DAX:

 

SWITCH(
    TRUE(),
    yourTable[Salesman] IN {"aadamek", "adomanski"}, "CEE",
    yourTable[Salesman] IN {"adous", "jim", "jane"}, "GER",
    ...,
    ...,
    // your escape value here e.g. "No Region" etc.
    // you can ignore this last argument if you want the escape to be BLANK()
)

 

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




niceee, thank you. I used in power query. But correct is:

------------------------------------------------------------------------------------

else if List.Contains( {"adous", "dperret", "fdidierjean", "rtimmers"}, [Salesman] ) then "CH"

------------------------------------------------------------------------------------

chatGPT helped me little bit.

 

Thank you.

 

 

Ah yes, silly mistake.

I've updated my post for the benefit of future readers.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




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.