Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
cia61
New Member

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
 
cia61_0-1628256185742.png

 

2 REPLIES 2
amitchandak
Super User
Super User

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

 

refer if this can help

How to divide/distribute values between start date or end date or count days across months/days: https://community.powerbi.com/t5/Community-Blog/How-to-divide-distribute-values-between-start-date-o...

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Although this points me in a direction I am having a hard time correlating this solution with the solution I need. 

 

How do I upload sample data?

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.