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
New_be
Helper IV
Helper IV

Different condition: To check Over Time

Hi experts! 😄

 

I have a problem to check the overtime based on multiple-conditions.

 

219_1.PNG

I have a table that have columns;
     1. HoursWorked

     2. ShiftHours > 30 mins

     3. Day Type: Whether "Working day" or "Off day"

 

I have ShiftHours > 30 mins column to check that on "Normal day"

     if [HoursWorked] >= [ShiftHours > 30 mins], "!", "-"

 

when i try to do it,

219_2.PNG

 

here is my code for that;

219_3.PNG

 

But it will be different if that employee worked on "Off day". Because, the total hours for that day will be count as "Overtime" right?

 

Below is the logic example;

219_4.PNG

 

So my Questions are;
     1. Why my second image shows like that? Is there any problem with my measure?

     2. Any possible way for me to calculate Overtime based on multiple conditions (Day type)?

 

Thanks in advance for all!

 

 

4 REPLIES 4
v-eqin-msft
Community Support
Community Support

Hi @New_be ,

Sorry to  disturb you...... But did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please upload some insensitive data samples and expected output.

 

Best Regards,
Eyelyn Qin

v-eqin-msft
Community Support
Community Support

Hi @New_be ,

You could use the following formula:

OverTime =
IF (
    MAX ( 'Table1'[Day Type] ) = "Off day",
    MAX ( 'Table1'[Hours worked] ),
    MAX ( 'Table1'[Hours worked] ) - MAX ( 'Table1'[ShiftHours > 30mins] )
)

My visualization looks like this:

9.22.1.1.png

Did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please upload some insensitive data samples and expected output.

 

Best Regards,
Eyelyn Qin

VijayP
Super User
Super User

@New_be 

VAR WorkingDayhours = calculate(working hours, daytype="Working dAy")
VAR offdayhours = calculate(working hours, daytype = offday)
RETURN

SWitch(TRUE(),
workdayhours>8,workdayhours-8,
offdayhours)

Try this funciton to get the desired result




Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
MY Blog || My YouTube Channel || Connect with me on Linkedin || My Latest Data Story - Ageing Analysis

Proud to be a Super User!


amitchandak
Super User
Super User

@New_be ,

|| _offDay what you want to do there.

Can you full condition like

Not(Isblank(_offDay )) or Isblank(_offDay ) or [Workday] >_offDay  and try.

 

Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

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.