Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi all,
I have a column called 'Business Area' that can have several possible values, one of them being 'Clean'. I would like to separate 'Clean' into 'WP' and 'WD'. I would do this by looking at the 'Site' column and if it contains 'ABC' it would be 'WP' and if it doesn't contain 'ABC' it is 'WD'. The logic would look like;
1) IF 'Business Area'="Clean" AND 'Site' CONTAINS "ABC" then RETURN "WP"
2) IF 'Business Area' = "Clean" AND 'Site' DOES NOT CONTAIN "ABC" RETURN "WD"
3) IF "Business Area" IS NOT "Clean" RETURN 'Business Area'
Expected result:
Business Area | Site | Business area test |
Clean | xxxx.WTW | WP |
Clean | xxxxxx.WPS | WD |
ER | xxxxx.STF | ER |
Clean | xxxxxxxx.SRE | WD |
I have written this for the first part:
Business area test = IF(AND(SEARCH("WTW",'SharePoint data'[Site],1,0)>0,'SharePoint data'[BusinessArea]="Clean"),"Water Production",'SharePoint data'[BusinessArea])
But require help to add statements 2 + 3 to complete this,
Thanks
Solved! Go to Solution.
HI @HH_95
Try the following code:
Business area test =
SWITCH (
TRUE (),
SEARCH ( "WTW", 'SharePoint data'[Site], 1, 0 ) > 0
&& 'SharePoint data'[BusinessArea] = "Clean", "Water Production",
SEARCH ( "WTW", 'SharePoint data'[Site], 1, 0 ) = 0
&& 'SharePoint data'[BusinessArea] = "Clean", "WD",
'SharePoint data'[BusinessArea] <> "Clean", 'SharePoint data'[BusinessArea]
)
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHI @HH_95,
You can try to use the following calculated column formula if helps:
Business Area Replaced=
IF (
'SharePoint data'[Business Area] = "Clean",
IF ( SEARCH ( "ABC", 'SharePoint data'[Site], 1, 0 ) > 0, "WP", "WD" ),
'SharePoint data'['Business Area']
)
Regards,
Xiaoxin Sheng
HI @HH_95
Try the following code:
Business area test =
SWITCH (
TRUE (),
SEARCH ( "WTW", 'SharePoint data'[Site], 1, 0 ) > 0
&& 'SharePoint data'[BusinessArea] = "Clean", "Water Production",
SEARCH ( "WTW", 'SharePoint data'[Site], 1, 0 ) = 0
&& 'SharePoint data'[BusinessArea] = "Clean", "WD",
'SharePoint data'[BusinessArea] <> "Clean", 'SharePoint data'[BusinessArea]
)
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsThanks, I used a slight variant(below) of this to get what i wanted.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
110 | |
94 | |
82 | |
66 | |
58 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |