The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
If I have figures like
AS 1,2,3,4
2. AS 1,3,4
And I want to extract only those where 2 appears and put it in a different column, how can I do that?
Solved! Go to Solution.
Hey @Anonymous ,
in addition to the solution @amitchandak already provided here is another one that is a little more detailed. Here the text 1,2,3,4 will be converted into a list, then the list items will be checked if one is 2. This prevents that a list item like 12 will being tested positive.
You can use this snippet inside the Power Query Custom Column dialog:
if List.Contains(
Text.Split( [else] , "," ) , "2" )
then "contains 2"
else "does not contain 2"
A screenshot:
And the result:
Hopefully, this provides what you are looking for.
Regards,
Tom
Hey @Anonymous ,
in addition to the solution @amitchandak already provided here is another one that is a little more detailed. Here the text 1,2,3,4 will be converted into a list, then the list items will be checked if one is 2. This prevents that a list item like 12 will being tested positive.
You can use this snippet inside the Power Query Custom Column dialog:
if List.Contains(
Text.Split( [else] , "," ) , "2" )
then "contains 2"
else "does not contain 2"
A screenshot:
And the result:
Hopefully, this provides what you are looking for.
Regards,
Tom
@Anonymous ,
In a new column power query
if Text.Contains([Column], "2") then [Column] else null
in DAX, a new column
if(Containsstring([Column], "2") ,[Column] ,blank())