Get certified for free when you join Fabric Data Days 2026 and dive into Fabric, Power BI, SQL, AI, and other essential data skills.
Join nowJuly 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more
i have two tables
First table has a date where citations were issued.
Second table has a date where officer was on a certain schedule.
The tables are joined by a unique ibm #
i am trying to filter the data to show what shift the officer wrote the tickets on. I can get total citations written by the officer but if that officer works on a different shift it also produces the total for that shift as a total of the officer
| ibm | offense_date | citation_number |
| jj220 | 01/01/2022 | 1 |
| jj220 | 01/01/2022 | 2 |
| jj220 | 01/02/2022 | 5 |
| aa420 | 01/01/2022 | 3 |
| aa420 | 01/01/2022 | 4 |
| aa420 | 01/02/2022 | 6 |
| ibm | shift | shift start date |
| jj220 | a shift | 01/01/2022 |
| jj220 | a shift | 01/02/2022 |
| aa420 | b shift | 01/01/2022 |
| aa420 | t shift | 01/02/2022 |
Solved! Go to Solution.
Create a calculated column on the Citation table
Shift =
var offenseDate = Citations[Offense date]
return SELECTCOLUMNS( TOPN( 1,
FILTER( RELATEDTABLE( Shifts ), Shifts[Start date] <= offenseDate ),
Shifts[Start date], DESC ),
"@shift", Shifts[Shift]
)
Create a calculated column on the Citation table
Shift =
var offenseDate = Citations[Offense date]
return SELECTCOLUMNS( TOPN( 1,
FILTER( RELATEDTABLE( Shifts ), Shifts[Start date] <= offenseDate ),
Shifts[Start date], DESC ),
"@shift", Shifts[Shift]
)
Thank you that works
Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.
If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!
Check out the July 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 26 | |
| 24 | |
| 23 | |
| 19 | |
| 17 |
| User | Count |
|---|---|
| 31 | |
| 28 | |
| 21 | |
| 19 | |
| 17 |