SOLVED

Need help with Power Query

Copper Contributor

In the picture, i have one row called Issued_Date which is followed in sequence date.

How do I make a step that allow the date to be Not followed by sequence?

Please help! Thanks!

4 Replies
Can you post a picture please

Leon_Redclifft_0-1580972998993.png

here you go

@PascalKTeam 

Please also post a picture of what the solution should look like, thanks
best response confirmed by Leon_Redclifft (Copper Contributor)
Solution

@Leon_Redclifft 

If you mean something like this

image.png

you may add index column, after that custom column where to check if previous date is equal to current one then return null else date. Plus cosmetic.

let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    ChangeType = Table.TransformColumnTypes(
        Source,
        {{"A", type text}, {"Date", type date}}
    ),
    AddIndex = Table.AddIndexColumn(ChangeType, "Index", 0, 1),
    AddCustom = Table.AddColumn(
        AddIndex,
        "Custom",
        each
            if ([Index] > 0) and (AddIndex[Date]{[Index]-1} = AddIndex[Date]{[Index]})
            then null
            else [Date]),
    RemoveOtherColumns = Table.SelectColumns(AddCustom,{"A", "Custom"}),
    RenameColumns = Table.RenameColumns(RemoveOtherColumns,{{"Custom", "Date"}})
in
    RenameColumns

 

1 best response

Accepted Solutions
best response confirmed by Leon_Redclifft (Copper Contributor)
Solution

@Leon_Redclifft 

If you mean something like this

image.png

you may add index column, after that custom column where to check if previous date is equal to current one then return null else date. Plus cosmetic.

let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    ChangeType = Table.TransformColumnTypes(
        Source,
        {{"A", type text}, {"Date", type date}}
    ),
    AddIndex = Table.AddIndexColumn(ChangeType, "Index", 0, 1),
    AddCustom = Table.AddColumn(
        AddIndex,
        "Custom",
        each
            if ([Index] > 0) and (AddIndex[Date]{[Index]-1} = AddIndex[Date]{[Index]})
            then null
            else [Date]),
    RemoveOtherColumns = Table.SelectColumns(AddCustom,{"A", "Custom"}),
    RenameColumns = Table.RenameColumns(RemoveOtherColumns,{{"Custom", "Date"}})
in
    RenameColumns

 

View solution in original post