How to remove text before the dash (-) sign
Best Answer
-
MID() and FIND() formulas will help here:
expected = MID(current,FIND("-", current)+1,<n>)
where <n> - max number of characters thich may appear after the dash sign.
2
Answers
-
Thanks!! It worked! 🙂0
-
While the solution provided by @KirillKuznetsov certainly works to meet the requirement, it's also important to recognize that text parsing functions and text line items in general are prone to sub-optimal performance. The Planual advises against using text as much as possible (see rules 2.02-04 and 2.03-02).
My guess based on the data format is that the data is coming from an external system. If possible, try to parse these values out upstream or in the ELT layer before it gets into Anaplan, as that will allow Anaplan to perform optimally.
However, if that is not possible, I have an alternate approach that will perform better, especially if the data set you are importing is sizable.
In order to improve performance here, you can take advantage of a subtlety about the way that alphanumeric fields are imported into Anaplan when importing them into a Number-formatted line item. There was actually a recent post on Community about this.
For the examples below, I will make the assumption that you want your final output to be Number formatted. Let's compare performance between the two options.
Option 1: text manipulation
Import the value as text, and use FIND, MID, and VALUE to get the final result.
Blueprint:
Grid view:
Option 2: alphanumeric import as a Number
Import as number (value will come in as -123 due to the subtlety mentioned above), and use ABS() to convert the value to positive. You could also do value*(-1), but I'm choosing ABS() here as an extra safeguard against values that may be missing a hyphen.
Blueprint:
Grid view:
Performance Comparison
I set up a test model that did not have any additional calculations based on the final result, and I mocked up a data set of 1M items in a csv file, using the same file for both examples above.
Using a simple stopwatch test:
Option 1: 9s
Option 2: 7s
So even in this simple test, we can see that the import will run faster in the second case, even though the import file and final result are the exact same. Note further that as you build more downstream logic on these constructs, performance issues can compound further, so we want to be very careful with text. Text will always be slower, so we should try to avoid it wherever we can, and in this case we can!
5 -
Hi! Could you help me essentially find the reverse of this? Basically I want to find everything to the Left of the dash.
0