Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi all,
I'm adding a custom column where values are based on conditional statement.
= Table.AddColumn( #"Added Index",
"Custom",
each
if Text.Contains(#"Added Index"{[Index] - 1}[INPUT],"ABC") then
"NEW TEXT"
else
[INPUT]
)
The answer in new column is correct, but in first row appears "Error" below since is doing {[Index] -1} for first element
Expression.Error: The index cannot be negative.
Details:
Value=[Table]
Index=-1
I added a "try otherwise.." before the "if" and output still shows Error for first element. How to handle this error? Thanks
Solved! Go to Solution.
Hi , @cgkas
You just need to update the "Added Index " steps to from 1 to ..., like this:(not start from 0)
If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem.
Thank you for your time and sharing, and thank you for your support and understanding of PowerBI!
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi , @cgkas
You just need to update the "Added Index " steps to from 1 to ..., like this:(not start from 0)
If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem.
Thank you for your time and sharing, and thank you for your support and understanding of PowerBI!
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
@cgkas You could do a Replace errors step and plug in whatever you did for your otherwise.
Thanks for your answer. I was wondering if is possible to handle the error withour adding extra step.
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
63 | |
63 | |
53 | |
39 | |
25 |
User | Count |
---|---|
85 | |
57 | |
45 | |
43 | |
38 |