Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Good Afternoon,
This should be a fairly straightforward calculation, but I am unable to get the syntax correct.
I would like to combine punch clock data from two different tables into one Summary Table. I have the first part working correctly which sums Total Hours worked by Employee for each date:
DailySummary = Summarize( OTStatistics, [Date], [Facility], [Employee_Code], [Employee_Name], "TotalHours", SUM( OTStatistics[Hours] ))
My next step is to create a Calculated Column for the "Scheduled Hours" from a separate table for each row of [Date] and [Employee_Code]. I have tried a number of different ways, but just can't get the Sum for each Row Context correct.
Pretty sure I will cringe when I see the answer.....
As always, your help is very much appreciated.
Kindest Regards to All,
Solved! Go to Solution.
Hi @rsbin ,
Are you trying add sum scheduled hours in Daily Summary table by date and Employee? Please try the following calculated column:
Column =
VAR a = 'Daily Summary'[Date]
VAR b = 'Daily Summary'[Employee_Code]
RETURN
CALCULATE (
SUM ( 'Schedule'[FacilityScheduledHours] ),
TREATAS ( ROW ( "Date", a ), 'Schedule'[Date] ),
TREATAS ( ROW ( "Employee_Code", b ), 'Schedule'[EEcode] )
)
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Best Regards,
Dedmon Dai
Hey @rsbin ,
please create a pbix that contains sample data but still reflects your data model. Upload the pbix to onedrive or dropbox and share the link. If you are using Excel to create the sample data, upload the Excel as well.
Regards,
Tom
@TomMartens Hi Tom,
Daily Summary Table:
Date | Facility | Employee_Code | Employee Name | Total Hours |
6/1/2018 | Site 1 | AA01 | Doe, John | 12 |
Schedule:
EECode | LastName | FirstName | Date | Facility | ScheduledHours |
AA01 | Doe | John | 6/1/2018 | Site 1 | 8 |
For this date and this Employee, I would like to join the Scheduled Hours into the Daily Summary table. I hope this clarifies.
( I still need to learn how to correctly upload a sample pbix) .
Hi @rsbin ,
Are you trying add sum scheduled hours in Daily Summary table by date and Employee? Please try the following calculated column:
Column =
VAR a = 'Daily Summary'[Date]
VAR b = 'Daily Summary'[Employee_Code]
RETURN
CALCULATE (
SUM ( 'Schedule'[FacilityScheduledHours] ),
TREATAS ( ROW ( "Date", a ), 'Schedule'[Date] ),
TREATAS ( ROW ( "Employee_Code", b ), 'Schedule'[EEcode] )
)
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Best Regards,
Dedmon Dai
Hello @v-deddai1-msft
Thank you for the response. I have done a quick test and looks like this was the solution I was looking for.
I have never used the TREATAS function before....will have to study this in more detail.
Thanks again and best regards,
User | Count |
---|---|
119 | |
78 | |
58 | |
52 | |
46 |
User | Count |
---|---|
170 | |
117 | |
63 | |
58 | |
51 |