March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
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
Else
Remove first character only
Is this possible to write in power query?
Solved! Go to Solution.
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)
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)
Hi @PCarson00 ,
How about this:
I created a new column with your requirement and the following code in M:
if Text.StartsWith([Column], "L01") or Text.StartsWith([Column], "L04") then Text.RemoveRange([Column], 0, 3 ) else Text.RemoveRange([Column], 0, 1 )
Let me know if this solves your quest 🙂
/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/
Did I answer your question❓➡️ Please, mark my post as a solution ✔️ |
Also happily accepting Kudos 🙂 |
Feel free to connect with me on LinkedIn! |
#proudtobeasuperuser |
Thanks Tom. On my end its not working - getting an error 'then' expected. I notice the or command is not blue?
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/
Did I answer your question❓➡️ Please, mark my post as a solution ✔️ |
Also happily accepting Kudos 🙂 |
Feel free to connect with me on LinkedIn! |
#proudtobeasuperuser |
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
124 | |
87 | |
85 | |
70 | |
51 |
User | Count |
---|---|
205 | |
153 | |
97 | |
79 | |
69 |