Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hello,
I have excel with Salesman:
and I need to add a region to the salesman but no in excel.
I want add regions to the salesman in Data wiew.
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. 🙂
Solved! Go to Solution.
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
Proud to be a Datanaut!
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
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
Proud to be a Datanaut!