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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
AlexanderPrime
Solution Supplier
Solution Supplier

Matrix Table with hours done per day with Start/End Date

Hi all.

 

Got a bit of a different query about "Start/End Dates" with time spent on each day needing to appear on a Matrix Table showing which days has a team member working for on a project.

 

Unfortunately the data provided is a bit basic and is in the following format. (Table name for example is: RESOURCE)

I also have a Date Table (DateTable) set up that will show the Day Number of the Month and Day Name. (Relationship is currently set to look at Start Date as Active with the Date Table Index, and the index also looks at End Date as an inactive relationship)

 

ID (Index)Staff Name      .Start Date           .End Date               .Hours/Day
1Staff 112/04/202212/04/20221.5
2Staff 212/04/202212/04/20220.5
3Staff 113/04/202216/04/20222
4Staff 113/04/202213/04/20221
5Staff 313/04/202213/04/20222

 

I'm trying to get it to output it to a matrix like below.

Staff Name12/04/2022     .13/04/2022        .14/04/2022        .15/04/2022       .16/04/2022       .17/04/2022      .
Staff 11.532220
Staff 20.500000
Staff 3020000

 

Essentially I need it to count everything on that day, including items over a set course of days.

 

Currently if I set up the matrix to show:

Rows: Staff Name
Columns: Day No (This is from the DateTable)
Values: Hour/Day

It will show most of this correctly. But Staff 1's time will not show the added hours from 14th to 16th, because EndDate isn't currently being factored in.

 

I'm thinking I need to do a calculation to assign these values on the DateTable potentially? But not quite sure which approach to take, or if there is a simpler way to do so. Any suggestions?


Please note - I am not affiliated with Microsoft, I'm just an end user like yourself.
Just a regular guy doin' Data Science.

If my post has helped you, please don't forget to thumbs up or click "Accept as solution" if it solved your problem!
1 ACCEPTED SOLUTION
AlexanderPrime
Solution Supplier
Solution Supplier

Figured it out via browsing other topics. Posting solution for others (We all hate those people who post "solved it" and never say HOW don't we!)

 

Needed to create a table but add the following code to crossjoin DateTable and Resource.

 

DateMatrix =
FILTER(
CROSSJOIN('DateTable','Resource'),
'DateTable'[Date] >= Resource[Start Date] && 'DateTable'[Date] <=Resource[End Date]
)
 
Then use this DateMatrix table as values on the matrix visual. 

Please note - I am not affiliated with Microsoft, I'm just an end user like yourself.
Just a regular guy doin' Data Science.

If my post has helped you, please don't forget to thumbs up or click "Accept as solution" if it solved your problem!

View solution in original post

1 REPLY 1
AlexanderPrime
Solution Supplier
Solution Supplier

Figured it out via browsing other topics. Posting solution for others (We all hate those people who post "solved it" and never say HOW don't we!)

 

Needed to create a table but add the following code to crossjoin DateTable and Resource.

 

DateMatrix =
FILTER(
CROSSJOIN('DateTable','Resource'),
'DateTable'[Date] >= Resource[Start Date] && 'DateTable'[Date] <=Resource[End Date]
)
 
Then use this DateMatrix table as values on the matrix visual. 

Please note - I am not affiliated with Microsoft, I'm just an end user like yourself.
Just a regular guy doin' Data Science.

If my post has helped you, please don't forget to thumbs up or click "Accept as solution" if it solved your problem!

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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