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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.