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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
javirmerino
Helper III
Helper III

Calculate if ReceivedTime Is In Working Hours

Hi All, I'm hoping that this is a quick fix and is something obvious i'm missing...

 

The below doesnt seem to be working correctly for me. There are no errors with syntax so my assumption is that there is an issue comparing the [ReceivedTime] field and the TIMEVALUE?

 

 

InWorkingHours = SWITCH( AND (SELECTEDVALUE ( 'SysAid Extract'[ReceivedTime] ) >= TIMEVALUE("09:00:00") , SELECTEDVALUE ( 'SysAid Extract'[ReceivedTime] ) < TIMEVALUE("17:00:00")), TRUE , FALSE ) 

 

 

 I've also tried amending the TIMEVALUE function to TIME, but am having the same issue. Each return is FALSE regardless of if the [ReceivedTime] is between 9 and 5.

 

Any ideas?

1 ACCEPTED SOLUTION

Hi @javirmerino 

I'm just seeing that the switch is not constructed correctly. Check out hot it works here:

Try this:

InWorkingHours =
IF (
    AND (
        SELECTEDVALUE ( 'SysAid Extract'[ReceivedTime] ) >= TIMEVALUE ( "09:00:00" ),
        SELECTEDVALUE ( 'SysAid Extract'[ReceivedTime] ) < TIMEVALUE ( "17:00:00" )
    ),
    TRUE,
    FALSE
)

 

For the pbix, you have to share the URL to the file hosted elsewhere: Dropbox, Onedrive... or just upload the file to a site like tinyupload.com (no sign-up required).

 

Please mark the question solved when done and consider giving kudos if posts are helpful.

Cheers  Datanaut

View solution in original post

3 REPLIES 3
AlB
Super User
Super User

Hi @javirmerino 

Can you share a sample pbix that reproduces the issue? It would then be more feasible to see what might be going on. 

 

Please mark the question solved when done and consider giving kudos if posts are helpful.

Cheers  Datanaut

 

Hi @AlB , not a problem. Whats the best way to share the file with you?

Hi @javirmerino 

I'm just seeing that the switch is not constructed correctly. Check out hot it works here:

Try this:

InWorkingHours =
IF (
    AND (
        SELECTEDVALUE ( 'SysAid Extract'[ReceivedTime] ) >= TIMEVALUE ( "09:00:00" ),
        SELECTEDVALUE ( 'SysAid Extract'[ReceivedTime] ) < TIMEVALUE ( "17:00:00" )
    ),
    TRUE,
    FALSE
)

 

For the pbix, you have to share the URL to the file hosted elsewhere: Dropbox, Onedrive... or just upload the file to a site like tinyupload.com (no sign-up required).

 

Please mark the question solved when done and consider giving kudos if posts are helpful.

Cheers  Datanaut

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors