Forum Discussion
Error in measures between two linked tables
Hello. I have two tables. Table_1 is for scheduled work that contains an employee ID, work area number, cost center number, the date, and the amount of scheduled hours (along with others that are irrelevant to this question). Table_2 is time punch info and contains employee ID, cost center number, the date, and the amount of hours worked. Note that workcenters are unique, but cost centers are not (workcenters are beneath cost centers). I have also created a unique ID (called Identifier) in both tables that concatenates the cost center number,the date, and the employee ID because employees can potentially punch twice in two different cost centers on a given day.
I am attempting to build a productivity report from this data, but the measure to compute total hours worked is not filtered correctly, and is returning the wrong value. Here is what I am doing:
4 Replies
- AnonymousNot applicable
I have also created two other measures to separate the hours worked and the hours scheduled:
mTotalStd= CALCULATE(SUM(Table_1[Scheduled Hours]),USERELATIONSHIP(Table_1[Identifier],Table_2[Identifier]))mTotalWorked= CALCULATE(SUM(Table_2[Total Work Hours]),USERELATIONSHIP(Table_1[Identifier],Table_2[Identifier]))I created a table shown in the top screenshot, but the total worked hours measure is off. The screenshot on the bottom is correct and the screenshot on the top is incorrect. The bottom is using summarize whereas top table is using the calculated measures. - v-juanli-msftCommunity Support
Hi Anonymous
I make a test as below, could you have a try like me?
Measure = SUM('1'[hour planned]) Measure 2 = SUM('2'[hour worked]) Measure 3 = [Measure]/[Measure 2]Best Regards
MaggieCommunity Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.- AnonymousNot applicable
v-juanli-msft Thanks for the response. The measures that you have provided work, but when I attempt to filter both measures by cost center, then that is when I get an error. My question then becomes how I can create a link between each cost center such that filtering works on both measures.
- v-juanli-msftCommunity Support
Hi Anonymous
I can't reproduce your problem.
Could you provide a simple test file, then upload to one drive and share me the link?
Best Regards
MaggieCommunity Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.