Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
hsnluca
New Member

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 

1 ACCEPTED SOLUTION

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 ()
)


Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

5 REPLIES 5
edhans
Super User
Super User

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

 

edhans_0-1697041235438.png

 



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

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

 

report error.png

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 ()
)


Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Thank you ,it working apprechiate your help , but i think ihave some problem in my filed format , what about if format has date or AM , PM ?? for example in photo  

 

date.png

Doesn't matter. That is formatting. The TIME() function uses military time, so TIME(15,0,0) is 3pm. My formula had both sides as PM times being 15 and 22 hrs...

 

Could you mark my answer as the solution please so this thread can be marked as completed and others searching for similar info will know that works? Thanks!



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors