Power Query sequence numbers

sadavies2906

New Member
Joined
Feb 5, 2011
Messages
45
Hi, I have the following Power Query running that eventually creates a workbook table with a column "WTL_SEQ_NEW"

let
Source = Excel.Workbook(File.Contents("N:\ManufacturingOps\Spares Overdue Weekly Report\2020 WORK TO LISTS\DATA FILES\SDD_ESC_Resource Requirement Report UK V2.xls"), null, true),
#"ESC Build" = Source{[Name="ESC Build"]}[Data],
#"Promoted Headers" = Table.PromoteHeaders(#"ESC Build", [PromoteAllScalars=true]),
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Start Date", type date}}),
#"Changed Type1" = Table.TransformColumnTypes(#"Changed Type",{{"Hours", type number}}),
#"Filtered Rows" = Table.SelectRows(#"Changed Type1", each [Location] = "POST VENDOR"),
#"Sorted Rows" = Table.Sort(#"Filtered Rows",{{"Start Date", Order.Ascending}}),
#"Replaced Value" = Table.ReplaceValue(#"Sorted Rows",null,"-",Replacer.ReplaceValue,{"Destination"}),
#"Replaced Value1" = Table.ReplaceValue(#"Replaced Value",null,"-",Replacer.ReplaceValue,{"Po Number"}),
#"Added Custom" = Table.AddColumn(#"Replaced Value1", "WTL_SEQ_NEW", each Text.End([Week],2)),
#"Sorted Rows1" = Table.Sort(#"Added Custom",{{"WTL_SEQ_NEW", Order.Ascending}, {"Assembly Item", Order.Ascending}, {"Job Number", Order.Ascending}})
in
#"Sorted Rows1"

The result is shown below as "CURRENT" but i would like to automatically create a sequence similar to "REQUIRED" where it increments by +1

1593678528907.png


Regards
Stephen
 
The xls files are a dump straight out of our ERP system that our IT department do automatically on a daily basis so unfortunately I don't have any input to get this changed, anything i create tend to be either xlsx or xlsm
 
Upvote 0

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Thanks sandy666 it works like a charm and i've managed to migrate it to the other tabs i needed it to as well.

Another quick question hopefully, in the "PRE VENDOR" tab I end up with a column Q that is empty apart from a substituted "-" that I built into the M CODE.

What I'm doing is manually copying the formula in cell AC2 on the same tab into this column and this essential returns a "YES" or "NO" based on the information in the "DAILY SHORTAGE" tab.

With M CODE could I get the SHORTAGE column to be "=IFNA(IF(MATCH([@[Job Number]],DAILY_DOWNLOAD[Job Number],0),"YES","NO"),"NO")" instead of the "-" and it will still work as a formula?

Thanks for all the help so far

Regards
Stephen
 
Upvote 0
You are welcome
if it works for you , you can hit Like (y) in the posts which helped you

are you trying mix M with worksheet formula? this is totally another logic.
maybe merge PRE VENDOR with DAILY SHORTAGE by index then remove all columns except one you need and create IF (Conditional Column). why you are searching through whole table DAILY SHORTAGE?
btw. you cannot change data type to text in the last created sequence column because column contain text, so if you change it you'll get error
 
Last edited:
Upvote 0
or just merge by columns Job Number. you need to test it what will be better
 
Upvote 0
When the Daily Download query runs i filter on a column called "NEXT ASSY PLANNER CODE" and just look for anything that contains "MESC", "MESCOV", "OSPESC" and "OSPESCOV" so this drastically reduces the size of the file.

This essentially gives me a table of "JOB NUMBERS" that contain shortages and the details of those shortages.

The INDEX, MATCH formula I manually add just looks to see if the "JOB NUMBER" on the "PRE VENDOR" tab is in the "DAILY SHORTAGE" table and returns the "yes" or "no"
 
Upvote 0

Forum statistics

Threads
1,214,594
Messages
6,120,436
Members
448,964
Latest member
Danni317

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top