Forum Discussion

cia61's avatar
cia61
New Member
5 years ago

Working with Dates

I have to report which Labor periods the data captured falls within.  So instead of using just the calendar month to filter data, I have to use time periods that cross calendar months.   I can use a DAX equation like the one below but it seems like If I used a "Labor Dates table (see below) and create a relationship to the time entered data I could do this more efficiently.

 

Dax Equation

YTD Labor = if('Akron Cyient Submitted Timeshee'[Work Date].[Date] >= DATE(2021,1,4) && 'Akron Cyient Submitted Timeshee'[Work Date].[Date] <= DATE(2021,1,31) ,"January",
                if('Akron Cyient Submitted Timeshee'[Work Date].[Date] >= DATE(2021,2,1) && 'Akron Cyient Submitted Timeshee'[Work Date].[Date] <= DATE(2021,2,28) ,"February",
                if('Akron Cyient Submitted Timeshee'[Work Date].[Date] >= DATE(2021,3,1) && 'Akron Cyient Submitted Timeshee'[Work Date].[Date] <= DATE(2021,3,28) ,"March",
                if('Akron Cyient Submitted Timeshee'[Work Date].[Date] >= DATE(2021,3,29) && 'Akron Cyient Submitted Timeshee'[Work Date].[Date] <= DATE(2021,5,2) ,"April",
                if('Akron Cyient Submitted Timeshee'[Work Date].[Date] >= DATE(2021,5,3) && 'Akron Cyient Submitted Timeshee'[Work Date].[Date] <= DATE(2021,5,30) ,"May",
                if('Akron Cyient Submitted Timeshee'[Work Date].[Date] >= DATE(2021,5,31) && 'Akron Cyient Submitted Timeshee'[Work Date].[Date] <= DATE(2021,6,27) ,"June",
                if('Akron Cyient Submitted Timeshee'[Work Date].[Date] >= DATE(2021,6,28) && 'Akron Cyient Submitted Timeshee'[Work Date].[Date] <= DATE(2021,8,1) ,"July",
                if('Akron Cyient Submitted Timeshee'[Work Date].[Date] >= DATE(2021,8,2) && 'Akron Cyient Submitted Timeshee'[Work Date].[Date] <= DATE(2021,8,29) ,"August",
                if('Akron Cyient Submitted Timeshee'[Work Date].[Date] >= DATE(2021,8,30) && 'Akron Cyient Submitted Timeshee'[Work Date].[Date] <= DATE(2021,9,26) ,"September",
                if('Akron Cyient Submitted Timeshee'[Work Date].[Date] >= DATE(2021,9,27) && 'Akron Cyient Submitted Timeshee'[Work Date].[Date] <= DATE(2021,10,31) ,"October",
                if('Akron Cyient Submitted Timeshee'[Work Date].[Date] >= DATE(2021,11,1) && 'Akron Cyient Submitted Timeshee'[Work Date].[Date] <= DATE(2021,11,28) ,"November",
                if('Akron Cyient Submitted Timeshee'[Work Date].[Date] >= DATE(2021,11,29) && 'Akron Cyient Submitted Timeshee'[Work Date].[Date] <= DATE(2022,1,1) ,"December","NA"))))))))))))
 
Labor Table
 

 

2 Replies