Forum Discussion
rvnaresh
Microsoft Employee
3 years agoTry to use OR function with if and text contains
Hi, I want to categorize the datacenter to a region like the table below and use it in one of my reports. Datacenter Location ABC01 Europe ABC02 Europe ACB01 Europe ACB02 Eur...
PhilipTreacy
Super User
3 years agoHi rvnaresh
Yes you could write this as a function, called FindRegion
(DataCenter as text) =>
let
DC = Text.Start(DataCenter , 2),
Regions = [
AB = "Europe",
AC = "Europe",
BA = "Americas",
BD = "Americas",
CA = "APAC",
CD = "APAC"
],
Source = if Record.HasFields(Regions, DC) then Record.Field(Regions, DC) else "Uncategorized"
in
Source
You'll need to add all of the data center codes and regions to the Regions record in this function.
You can then call it in a new Custom Column like this
= FindRegion([Data Center])
regards
Phil
rvnaresh
Microsoft Employee
3 years agoThanks Phil..
will give it a try