Forum Discussion
Group Non-Matching Dates?
I posted a denser version of this yesterday, here's hoping I can present it a bit better lol.
I have two spreadsheets of hours by employees. One is how many hours we budgeted for the employee for various centers and departments. The other is how much they actually applied for that center.
The budgeted spreadsheet gives an hours budget by month of posting. So, for example, January 2020 has 240 hours posted into it for the month. All hours from 12/15/2019 - 01/25/2020 post in the month of January.
The actual spreadsheet has dates for the actual hours worked by a given person. So everyone that charged on 12/15, 12/16, etc.
What I need to do is to be able to have my budgeted hours and my actual hours line up in what would be the correct posting period, so I can do something like the bar chart below based on Year/Quarter/Month.
Well, due to the dates in the Actual spreadsheet being the date actually worked and not the "posting" date, it throws my formatting off. In the screenshot below, Q4 I have actual hours (dark blue column) appearing. Of course, we shouldn't have this here. Those are the hours from my second screenshot that should actually be in the first dark blue column, because although they were actually worked in Q4, that was Q4 of 2019 and they posted in 2020.
What I need to be able to do is find a way to take those hours that posted on actual dates (screenshot 2) and get them to relate to the budgeted month. So I need to somehow say that 12/15/2019 - 01/25/2020 relates to the posting month of January, 01/26 - 02/22/2020 relates to the posting month of February 2020, etc.
Unfortunately I can't share any of the files, but I'm happy to post as much as possible to make this more understandable.
- Screenshot 1
- Screenshot 2
4 Replies
- lbendlinSuper User
In your Calendar table add a column that indicates the budget year-month for each date.
- AnonymousNot applicable
By calendar table are you referring to the one I'm using in PBI? I assume so.
See that's going to be a difficult feat as far as I can tell. What I just did in the query editor for the Actual Hours spreadsheet was make a conditional column to look at the dates, and if it is prior to a certain date, return a Month for "Posting Month". Definitely not the method I prefer but I was thinking it might be a step in the right direction, but it doesn't appear to be working.
I think I can visualize what you're saying. By creating a column in the calendar table that basically says "for dates X, return year-month Y". But I'm not sure how I would create something like this in DAX.
Ex in screenshot:
- lbendlinSuper User
You don't normally do this in DAX or even in Power Query. Much simpler and safer to produce that Calendar table outside of Power BI. In a pinch this could even come from an Excel file on a sharepoint, for example.