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
BentheSisko
New Member

Help Converting Excel Meal Compliance Formula to DAX

I'm trying to recreate an excel formula for meal compliance in DAX and I'm getting stuck. My original formula is 

=IFS(AND(O2>=6.01,K2=K3),"Late Meal",AND(O2>=6.01,K2<>K3),"No Meal",O2<6.01,"(left blank)")

Where O = Regular Hrs worked, and 

K is a helper column in Excel that concatenates two other columns, EID and Date.
Meal breaks are to be taken between 4th and 6th hr of each shift.
IF regular hrs are greater than 6.01 AND the employee has two time-entries for the day, THEN they had a late lunch
IF regular hrs are greater than 6.01 AND the employee has a single time entry for the day, THEN they missed lunch 
 
 
It looks like my best bet would be us a switch function similar to the one below, but with meal compliance logic. I'm stuck in creating a column with a running total  of the # of time punches each day for each employee. Ideally the first punch of the day would be  1, the second punch a 2, and so on. Thank you for your help!
 
BentheSisko_1-1667242692399.png 
2 REPLIES 2
PhilipTreacy
Super User
Super User

Hi @BentheSisko 

 

Any chance you can share your PBIX file?  Too hard to recreate everything.

 

Regards

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Of course. The PBIX File is here.  Thanks for your help!

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.