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
th3h0bb5
Resolver II
Resolver II

FOR loop to update Variable?

I'm in charge of making sure all employeed receive 8 hours (480 minutes) of training every 60 days. As soon as they hit that mark, their 60 day clock starts over (yes, I know that's dumb).  My data is three columns: Employee, Date Trained, Total Minutes.

 

As an example, if Bob gets 8 hours of training on 12/10/2019, he must get another 8 hours before 2/8/2020 (60 days later). If Bob gets in another 8 hours four days later (12/14), the 60 days clock resets and now he must get 8 hours in before 2/12.

 

How can I do this in DAX?

 

Here's my data:

 
EmployeeDate TrainedTotal Minutes
Bob11/6/2019113
Bob11/7/2019375
Bob11/14/2019191
Sarah9/30/2019

730

Sarah10/2/201950

 

Using Bob as an example, I think I need to:

 

  1. Create a Variable for StartDate
    1. StartDate = MIN(Date Trained)  --11/6/2019
  2. Create a Variable that is DueDate
    1. DueDate = DATEADD (StartDate,  60, DAYS)  --1/5/2019
  3. Row-by-row for a given employee, SUM the minutes worked since StartDate
  4. If that SUM goes above 480 for a given employee, update the DueDate variable to the Date Trained plus 60 days
2 REPLIES 2
v-easonf-msft
Community Support
Community Support

Hi , @th3h0bb5 

I'm a little confused by your description.

Please kindly share your sample data and expected result  if you don't have any Confidential Information. Please upload your files to One Drive and share the link here.

 

Best Regards,
Community Support Team _ Eason

Here is a link to some sample data. The 'DueDate' column is the desired outcome. 

 

The 'Due Date' value begins at 60 days from the earliest 'Date Worked' for a given employee. Once the SUM of 'Total MIN' passes 8 hours, that DueDate gets updated.

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.