Forum Discussion

hsnluca's avatar
hsnluca
New Member
2 years ago
Solved

Create night shift range

 

hello ,

 

I want add night shift in Power BI range in column selected from issue time column  (03:30 PM) to (10:00 PM) 

so all time between this range will show in column  as N . 

 

this xls file 

https://docs.google.com/spreadsheets/d/1h-y63T-4Yzijatr_AtedHJ4Wkb1WE8W-tQlBxS2t-dg/edit?usp=sharing 

  • You posted this in the Power Query forum, so I have you M code for Power Query. 
    DAX has a very different syntax.

    New Column =
    IF (
        Table1[issue time]
            >= TIME ( 15, 30, 00 )
            && Table1[issue time]
                <= TIME ( 22, 00, 00 ),
        Table1[issue time],
        BLANK ()
    )
    

5 Replies

  • edhans's avatar
    edhans
    Community Champion

    The following formula in a new custom column will grab all times between 3:30pm and 10:00pm.

     

    if [issue time] >= #time(15,30,00) and [issue time] <= #time(22,00,00) then [issue time] else null

     

     

    • hsnluca's avatar
      hsnluca
      New Member

      Thank you for response, the sound good but the synatx error showing 

       

      • edhans's avatar
        edhans
        Community Champion

        You posted this in the Power Query forum, so I have you M code for Power Query. 
        DAX has a very different syntax.

        New Column =
        IF (
            Table1[issue time]
                >= TIME ( 15, 30, 00 )
                && Table1[issue time]
                    <= TIME ( 22, 00, 00 ),
            Table1[issue time],
            BLANK ()
        )