Forum Discussion

sixelapowerbi's avatar
sixelapowerbi
Regular Visitor
3 years ago
Solved

Set the current phase in a process

Hello everyone,

 

I need help creating a new column in Power Query that would define the "Current Phase" of each asset in my process.

Here is an example.

 

IDPhaseNumberStartEndActivePhaseCurrentPhase
0011DD.MM.YYYYDD.MM.YYYYNoNo
0012DD.MM.YYYY*TODAY*YesYes
0013DD.MM.YYYY*TODAY*YesNo
0014DD.MM.YYYYDD.MM.YYYYNoNo
0021DD.MM.YYYYDD.MM.YYYYNoNo
0022DD.MM.YYYYDD.MM.YYYYNoNo
0023DD.MM.YYYY*TODAY*YesYes
0024DD.MM.YYYY*TODAY*YesNo
0031DD.MM.YYYYDD.MM.YYYYNoNo
0032DD.MM.YYYYDD.MM.YYYYNoNo
0033DD.MM.YYYYDD.MM.YYYYNoNo
0034DD.MM.YYYYDD.MM.YYYYNoNo
0041DD.MM.YYYYDD.MM.YYYYNoNo
0042DD.MM.YYYYDD.MM.YYYYNoNo
0043DD.MM.YYYY*TODAY*YesYes
0044DD.MM.YYYYDD.MM.YYYYNoNo

 

Currently my "ActivePhase" column looks if the "End" date is *TODAY*, so "Yes", if not "No".
I can have several active phases but I can only have at most one "CurrentPhase".

So I would like my "Current Phase" column to take the active phase which has the smallest 'PhaseNumber' for each ID.

 

Do you have any ideas please.

  • Hi,

    to obtain this

    - add a Today column

    Date.From( DateTimeZone.FixedUtcNow())

    - determine ActivePhase with a conditional column

     

    - filtered rows

    - grouped filtered table

    - from a previous step i get unfiltered table

    - merge unfiltered with grouped

    = Table.NestedJoin(Custom1, {"ID"}, MinStart, {"ID"}, "Custom1", JoinKind.LeftOuter)

    (you can merge the unfiltered with itself then change the second table)

    - expanded 

    - then add a conditional column for CurrentPhase

    If this post is useful to help you to solve your issue, consider giving the post a thumbs up and accepting it as a solution!

     

     

     

2 Replies

  • Hi,

    to obtain this

    - add a Today column

    Date.From( DateTimeZone.FixedUtcNow())

    - determine ActivePhase with a conditional column

     

    - filtered rows

    - grouped filtered table

    - from a previous step i get unfiltered table

    - merge unfiltered with grouped

    = Table.NestedJoin(Custom1, {"ID"}, MinStart, {"ID"}, "Custom1", JoinKind.LeftOuter)

    (you can merge the unfiltered with itself then change the second table)

    - expanded 

    - then add a conditional column for CurrentPhase

    If this post is useful to help you to solve your issue, consider giving the post a thumbs up and accepting it as a solution!