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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
stuart_reeves
Regular Visitor

define time values into shifts

Hi!

 

I am trying to define incident times into where they fall within a shift.

I have tried a few things but cannot get the formula right. I want all incidents that fall within the following times, to fall into their perspective shifts:

 

06:30:00 - 18:29:59   = Day

18:30:00 - 06:29:59   = Night

 

I've (pathetically) managed to display anything from 18:30-25:59 as Night using: 

Shift = IF('HART/HEMS data'[Response_Time] >= Time(18,30,00),"Night")
However, I cannot get my head around how to format this the way I want it.
 
Any help would be greatly appreciated 🙂
 
Thank you in advance.
1 ACCEPTED SOLUTION
v-cazheng-msft
Community Support
Community Support

Hi @stuart_reeves 

You can create a Calculated column or Measure.

 

1 Calculated column

 

Shift column = IF('HART/HEMS data'[Response_Time] >= Time(18,30,00)||'HART/HEMS data'[Response_Time]<=TIME(6,29,59),"Night","Day")

 

 

2 Measure

 

Shift Meaasure = IF(SELECTEDVALUE('HART/HEMS data'[Response_Time]) >= Time(18,30,00)||SELECTEDVALUE('HART/HEMS data'[Response_Time])<=TIME(6,29,59),"Night","Day")

 

 

The result looks like this:

v-cazheng-msft_0-1617932887864.png

 

For more details, you can refer the attached pbix file.

 

Best Regards

Caiyun Zheng

 

Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

3 REPLIES 3
v-cazheng-msft
Community Support
Community Support

Hi @stuart_reeves 

You can create a Calculated column or Measure.

 

1 Calculated column

 

Shift column = IF('HART/HEMS data'[Response_Time] >= Time(18,30,00)||'HART/HEMS data'[Response_Time]<=TIME(6,29,59),"Night","Day")

 

 

2 Measure

 

Shift Meaasure = IF(SELECTEDVALUE('HART/HEMS data'[Response_Time]) >= Time(18,30,00)||SELECTEDVALUE('HART/HEMS data'[Response_Time])<=TIME(6,29,59),"Night","Day")

 

 

The result looks like this:

v-cazheng-msft_0-1617932887864.png

 

For more details, you can refer the attached pbix file.

 

Best Regards

Caiyun Zheng

 

Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Hi @v-cazheng-msft 

 

That's brilliant, thank you! 

Jihwan_Kim
Super User
Super User

Hi, @stuart_reeves 

If it is OK with you, please share your sample pbix file's link here, then I can try to look into it to come up with a more accurate measure.

 

Thank you very much.

 

Hi, My name is Jihwan Kim.

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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