Hi Sandy / Rich ( Individually on separate sheet i am success full to run below (RICH) steps, while i have to add in my current sheet.
I tried many errors.
Any thoughts
Below (RICH) steps I have to add in my current code.
==================================================================================
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
Number = Table.AddColumn(Source, "Number", each Text.Select([Rawdata],{"0".."9"})),
LenRaw = Table.AddColumn(Number, "Length", each Text.Length([Rawdata]), Int64.Type),
LenNum = Table.AddColumn(LenRaw, "Length.1", each Text.Length([Number]), Int64.Type),
Subtract = Table.AddColumn(LenNum, "Subtraction", each [Length] - [Length.1], type number),
IF = Table.AddColumn(Subtract, "IF", each if [Length.1] = 0 then [Length] else [Subtraction]-1),
Range = Table.AddColumn(IF, "Text Range", each Text.Middle([Rawdata], 0, [IF]), type text),
TSC = Table.SelectColumns(Range,{"Rawdata", "Text Range"})
in
TSC
========================================================================================
I have to add Rich steps as last from last steps from my current code
Current Sheet Code
let
Source = Folder.Files("C:\Users\Rehmans\Desktop\Karcher Slotting\SOH"),
#"Removed Other Columns" = Table.SelectColumns(Source,{"Content", "Name"}),
#"Added Custom" = Table.AddColumn(#"Removed Other Columns", "Custom", each Csv.Document([Content])),
#"Added Custom1" = Table.AddColumn(#"Added Custom", "Custom.1", each Table.PromoteHeaders([Custom])),
#"Expanded Custom.1" = Table.ExpandTableColumn(#"Added Custom1", "Custom.1", {"Tag ID", "SKU", "SKU Description", "Location", "Location Zone", "Sub Zone", "Qty On Hand", "Move Date", "Condition Code"}, {"Tag ID", "SKU", "SKU Description", "Location", "Location Zone", "Sub Zone", "Qty On Hand", "Move Date", "Condition Code"}),
#"Removed Columns" = Table.RemoveColumns(#"Expanded Custom.1",{"Content", "Name", "Custom"}),
#"Added Custom2" = Table.AddColumn(#"Removed Columns", "Custom_Zone", each if [Sub Zone] = "EURO" and [Location Zone]="50PIC01" then "LLOP" else
if Text.Start([Sub Zone],4) = "MEZZ" and [Location Zone]="50PIC01" then "MEZZ" else
if Text.Start([Sub Zone],4) = "BULK" and [Location Zone]="40BLK01" then "BULK" else
if Text.Start([Sub Zone],4) = "MACH" and [Location Zone]="40BLK01" then "BULK" else
if Text.Start([Sub Zone],4) = "ACID" and [Location Zone]="40BLK01" then "BULK" else
if Text.Start([Sub Zone],3) = "AIR" and [Location Zone]="50PIC01" then "AIR" else
if Text.Start([Sub Zone],3) = "LSS" and [Location Zone]="50PIC01" then "LLOP" else
if Text.Start([Sub Zone],3) = "LSS" and Text.End([Sub Zone],1)="S" and [Location Zone]="40BLK01" then "HLOP" else
if Text.Start([Sub Zone],4) = "EURO" and [Location Zone]="40BLK01" then "HLOP" else ""),
#"Filtered Rows" = Table.SelectRows(#"Added Custom2", each ([Location Zone] = "40BLK01" or [Location Zone] = "50PIC01")),
#"Duplicated Column" = Table.DuplicateColumn(#"Filtered Rows", "Location", "Location - Copy"),
#"Renamed Columns" = Table.RenameColumns(#"Duplicated Column",{{"Location - Copy", "Rawdata"}})
in
#"Renamed Columns"