Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
Hi,
I am currently working on 2 tables the first table has an employees total hours for the day and the second table is the department details of the employee. When I establish a relationship and combine them with my date dim I get repeated rows.
I would really appreciate your help on this.
Table 1
EID | ENTRY DATE | HOURS |
111111 | 01/01/2019 | 2 |
111111 | 05/01/2019 | 1 |
111111 | 06/01/2019 | 2 |
111111 | 07/01/2019 | 3 |
111111 | 08/01/2019 | 4 |
111111 | 09/01/2019 | 2 |
Table 2
EID | DEPARTMENT | EFFECTIVE DATE | END DATE |
111111 | HR | 01/01/2019 | 05/01/2019 |
111111 | FINANCE | 06/01/2019 |
Thank you,
Patrick
Solved! Go to Solution.
hi, @PatrickLamoste
Since your two table is a many to many relationship, and there is no [DEPARTMENT] filed in table1, so it will lead to this result.
And from your sample data, I think this your expected output.
Create a measure instead of drag [Hours] into visual directly.
Measure = CALCULATE ( SUM ( Table1[HOURS] ), FILTER ( Table1, Table1[ENTRY DATE] >= MIN ( Table2[EFFECTIVE DATE] ) && Table1[ENTRY DATE] <= IF ( MAX ( Table2[END DATE] ) = BLANK (), DATE ( 9999, 12, 31 ), MAX ( Table2[END DATE] ) ) ) )
Result:
and here is sample pbix file, please try it.
Best Regards,
Lin
hi, @PatrickLamoste
Since your two table is a many to many relationship, and there is no [DEPARTMENT] filed in table1, so it will lead to this result.
And from your sample data, I think this your expected output.
Create a measure instead of drag [Hours] into visual directly.
Measure = CALCULATE ( SUM ( Table1[HOURS] ), FILTER ( Table1, Table1[ENTRY DATE] >= MIN ( Table2[EFFECTIVE DATE] ) && Table1[ENTRY DATE] <= IF ( MAX ( Table2[END DATE] ) = BLANK (), DATE ( 9999, 12, 31 ), MAX ( Table2[END DATE] ) ) ) )
Result:
and here is sample pbix file, please try it.
Best Regards,
Lin
Thank you! This works perfectly.
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the September 2025 Power BI update to learn about new features.