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
AndreT
Helper I
Helper I

Calculate in hours opportunities

during

Hi guys,
I am looking for a formula which would allow me to mark opportunities which arise  working hours.

 

I have already created created formula which shows me days of a week Day = FORMAT(MatchedTraders[createdAt Date],"DDDD")

 

I also have column with Created time

All I need is now a column which says:

 

In hours opportunities = if [Day] = Saturday or Sunday and [created_Time] 10am to 1pm, if [Day] =Monday to Friday and [created_Time] 8am to 6pm, "in hours", "outside working hours")

 

Does anyone know how to construct such calculation?

 

Many thanks in advance

Andre

1 ACCEPTED SOLUTION
Zubair_Muhammad
Community Champion
Community Champion

@AndreT

 

Try this calculated Column

 

=
IF (
    OR (
        OR ( MatchedTraders[Day] = "Sunday", MatchedTraders[Day] = "Saturday" )
            && HOUR ( MatchedTraders[Created Time] ) >= 10
            && HOUR ( MatchedTraders[Created Time] ) < 13,
        MatchedTraders[Day] <> "Sunday"
            && MatchedTraders[Day] <> "Saturday"
            && HOUR ( MatchedTraders[Created Time] ) >= 8
            && HOUR ( MatchedTraders[Created Time] ) < 18
    ),
    "in hours",
    "outside working hours"
)

Regards
Zubair

Please try my custom visuals

View solution in original post

3 REPLIES 3
Zubair_Muhammad
Community Champion
Community Champion

@AndreT

 

Try this calculated Column

 

=
IF (
    OR (
        OR ( MatchedTraders[Day] = "Sunday", MatchedTraders[Day] = "Saturday" )
            && HOUR ( MatchedTraders[Created Time] ) >= 10
            && HOUR ( MatchedTraders[Created Time] ) < 13,
        MatchedTraders[Day] <> "Sunday"
            && MatchedTraders[Day] <> "Saturday"
            && HOUR ( MatchedTraders[Created Time] ) >= 8
            && HOUR ( MatchedTraders[Created Time] ) < 18
    ),
    "in hours",
    "outside working hours"
)

Regards
Zubair

Please try my custom visuals

Perfect it worked. Thank you!

 

@AndreT,

 

By the way, you may help accept solution. Your contribution is highly appreciated.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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