Forum Discussion
PCarson00
2 years agoFrequent Visitor
IF conditions for filtering in Power Query
I have a set of data I want to filter in one column but not sure how to go about this. Here is my attempt at the explanation IF text begins with "L01" or "L04" then remove first 3 characters ...
- 2 years ago
pls try this
if Text.Start([DATA],3) ="L01" or Text.Start([DATA],3) ="L04" then Text.RemoveRange([DATA],0,3) else Text.RemoveRange([DATA],0,1) or======== if Text.StartsWith([DATA],"L01") or Text.StartsWith([DATA],"L04") then Text.RemoveRange([DATA],0,3) else Text.RemoveRange([DATA],0,1)
PCarson00
2 years agoFrequent Visitor
Thanks Tom. On my end its not working - getting an error 'then' expected. I notice the or command is not blue?
tackytechtom
2 years agoMost Valuable Professional
Hi PCarson00 ,
This is probably because there was some other stuff ("Table.AddColumn..., each") in the custom column formula box. My screenshot was probably misleading 🙂
Here how it's supposed to look like:
Happy you found a solution anyway! 🙂
/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/