Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

IF Statements For Date and Time

Hello,

I am trying to create an IF statement by date and time to associate a shift letter to(A.B,C,D).

I have an end date column pulling from a table in this format: 10/21/2019 2:00:00 PM.

I would like to assign a shift to this date and time column.

If B shift is 12:00 PM to 6:00 PM, then the example above would be assigned B shift.

I am connected via ODBC and using Power BI.

Any help would be much appreciated.

  • VasTg's avatar
    VasTg
    6 years ago

    Anonymous 

     

    The syntax is for M query.

     

    Open Edit queries, Add column->Custom Column -> Paste your script and rename the column.

     

    If this helps, mark it as a solution

    Kudos are nice too

10 Replies