Forum Discussion
Question on data formatting
- 7 years ago
Hi kracrde,
You can model your data using the Query editor. As you have different cases in the data, some are having a delimiter '-' and some are starting with an alphabet. You need to apply the cleanup to all cases. Please see the video below that I created for you.
If this helped you, please mark this post as an accepted solution and like to give KUDOS .
Regards,
Affan
Hi,
Can you try this formula for your calculated column?
Item =
IF (
LEFT ( RIGHT ( Table1[ItemNumbers], 4 ), 3 ) = "000",
LEFT ( Table1[ItemNumbers], 5 ),
Table1[ItemNumbers]
)
Sample Output
| Original Item Numer | Item |
| M78644 | M78644 |
| 78644-001 | 78644 |
| 78644 | 78644 |
| 78644-005 | 78644 |
This formula is only to test the logic as I have assumed that minimum there will be 5 characters. If you have items with length less than 5 characters, error will happen. You have to use IFERROR function to handle that error.
kracrde If you want to do it in Power Query, please try "Custom Column" as below
if Text.Start(Text.End([Value],5),4) = "-000" then "78644" else [Value]