Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello:
I am trying to join two tables by "Line Name" with table one filtering the data in table two by date range such that table table two to only show data WHERE "timestamp" falls within the "SHIFT PERIOD START" AND "SHIFT PERIOD END" and WHERE "LINE NAME = "LINE NAME". Tried the community but I am not able to get it. Any help would be greatly appreciated. Thanks
Table one: Shift Filter from Teams: Shifts
LINE NAME | SHIFT IS ACTIVE | SHIFT START DATE AND TIME | SHIFT END DATE AND TIME | SHIFT PERIOD IS SCHEDULED ACVTIVE | SHIFT PERIOD START | SHIFT PERIOD END | SHIFT PERIOD ID CODE | SHIFT PERIOD NAME |
CX482 MAIN LINE SANDBOX | TRUE | 4/20/2020 8:00:00 AM | 4/20/2020 5:00:00 PM | TRUE | 4/20/2020 8:15:00 AM | 4/20/2020 9:00:00 AM | Fw | FIrst Work Period |
CX482 MAIN LINE SANDBOX | TRUE | 4/20/2020 8:00:00 AM | 4/20/2020 5:00:00 PM | TRUE | 4/20/2020 8:15:00 AM | 4/20/2020 9:00:00 AM | Fw | FIrst Work Period |
CX482 MAIN LINE SANDBOX | TRUE | 4/20/2020 8:00:00 AM | 4/20/2020 5:00:00 PM | TRUE | 4/20/2020 8:15:00 AM | 4/20/2020 9:00:00 AM | Fw | FIrst Work Period |
CX482 MAIN LINE SANDBOX | TRUE | 4/20/2020 8:00:00 AM | 4/20/2020 5:00:00 PM | TRUE | 4/20/2020 8:15:00 AM | 4/20/2020 9:00:00 AM | Fw | FIrst Work Period |
CX482 MAIN LINE SANDBOX | TRUE | 4/20/2020 8:00:00 AM | 4/20/2020 5:00:00 PM | TRUE | 4/20/2020 8:15:00 AM | 4/20/2020 9:00:00 AM | Fw | FIrst Work Period |
CX482 MAIN LINE SANDBOX | TRUE | 4/20/2020 8:00:00 AM | 4/20/2020 5:00:00 PM | TRUE | 4/20/2020 8:15:00 AM | 4/20/2020 9:00:00 AM | Fw | FIrst Work Period |
CX482 MAIN LINE SANDBOX | TRUE | 4/20/2020 8:00:00 AM | 4/20/2020 5:00:00 PM | TRUE | 4/20/2020 8:15:00 AM | 4/20/2020 9:00:00 AM | Fw | FIrst Work Period |
CX482 MAIN LINE SANDBOX | TRUE | 4/20/2020 8:00:00 AM | 4/20/2020 5:00:00 PM | TRUE | 4/20/2020 8:15:00 AM | 4/20/2020 9:00:00 AM | Fw | FIrst Work Period |
CX482 MAIN LINE SANDBOX | TRUE | 4/20/2020 8:00:00 AM | 4/20/2020 5:00:00 PM | TRUE | 4/20/2020 9:15:00 AM | 4/20/2020 12:00:00 PM | Sw | Second Work Period |
CX482 MAIN LINE SANDBOX | TRUE | 4/20/2020 8:00:00 AM | 4/20/2020 5:00:00 PM | TRUE | 4/20/2020 9:15:00 AM | 4/20/2020 12:00:00 PM | Sw | Second Work Period |
CX482 MAIN LINE SANDBOX | TRUE | 4/20/2020 8:00:00 AM | 4/20/2020 5:00:00 PM | TRUE | 4/20/2020 9:15:00 AM | 4/20/2020 12:00:00 PM | Sw | Second Work Period |
CX482 MAIN LINE SANDBOX | TRUE | 4/20/2020 8:00:00 AM | 4/20/2020 5:00:00 PM | TRUE | 4/20/2020 9:15:00 AM | 4/20/2020 12:00:00 PM | Sw | Second Work Period |
CX482 MAIN LINE SANDBOX | TRUE | 4/20/2020 8:00:00 AM | 4/20/2020 5:00:00 PM | TRUE | 4/20/2020 9:15:00 AM | 4/20/2020 12:00:00 PM | Sw | Second Work Period |
Table Two: Machine State data
error text | category num | category text | timestamp | time no millis | Index | short name | Line Name |
S040 MACHINE IS BLOCKED | 5 | MACHINE BLOCKED | 3/6/2020 12:31 | 3/6/2020 12:31 | 1 | CX482 S040 | CX482 MAIN LINE SANDBOX |
+S040 RC2 ROBOT GRIPPER PART PRESENT LH MISSING | 1 | MACHINE ERRORS | 3/6/2020 12:31 | 3/6/2020 12:31 | 2 | CX482 S040 | CX482 MAIN LINE SANDBOX |
+S040_ROBOT ARM RC1_R2 EXECUTION ERROR | 1 | MACHINE ERRORS | 3/6/2020 12:31 | 3/6/2020 12:31 | 3 | CX482 S040 | CX482 MAIN LINE SANDBOX |
+S040 RC2 ROBOT GRIPPER PART PRESENT LH MISSING | 1 | MACHINE ERRORS | 3/6/2020 12:31 | 3/6/2020 12:31 | 4 | CX482 S040 | CX482 MAIN LINE SANDBOX |
+S040_ROBOT ARM RC1_R2 EXECUTION ERROR | 1 | MACHINE ERRORS | 3/6/2020 12:31 | 3/6/2020 12:31 | 5 | CX482 S040 | CX482 MAIN LINE SANDBOX |
+S040 RC2 ROBOT GRIPPER PART PRESENT LH MISSING | 1 | MACHINE ERRORS | 3/6/2020 12:31 | 3/6/2020 12:31 | 6 | CX482 S040 | CX482 MAIN LINE SANDBOX |
+S040_ROBOT ARM RC1_R2 EXECUTION ERROR | 1 | MACHINE ERRORS | 3/6/2020 12:31 | 3/6/2020 12:31 | 7 | CX482 S040 | CX482 MAIN LINE SANDBOX |
+S040 RC2 ROBOT GRIPPER PART PRESENT LH MISSING | 1 | MACHINE ERRORS | 3/6/2020 12:31 | 3/6/2020 12:31 | 8 | CX482 S040 | CX482 MAIN LINE SANDBOX |
+S040_ROBOT ARM RC1_R2 EXECUTION ERROR | 1 | MACHINE ERRORS | 3/6/2020 12:31 | 3/6/2020 12:31 | 9 | CX482 S040 | CX482 MAIN LINE SANDBOX |
+S040 RC2 ROBOT GRIPPER PART PRESENT LH MISSING | 1 | MACHINE ERRORS | 3/6/2020 12:31 | 3/6/2020 12:31 | 10 | CX482 S040 | CX482 MAIN LINE SANDBOX |
+S040_ROBOT ARM RC1_R2 EXECUTION ERROR | 1 | MACHINE ERRORS | 3/6/2020 12:31 | 3/6/2020 12:31 | 11 | CX482 S040 | CX482 MAIN LINE SANDBOX |
Solved! Go to Solution.
Hi @Anonymous ,
We can merge tables based on Line name and filter the table based on the new custom column
let
Source = Table.NestedJoin(Shifts, {"LINE NAME"}, #"Machine State data", {"Line Name"}, "Machine State data", JoinKind.LeftOuter),
#"Expanded Machine State data" = Table.ExpandTableColumn(Source, "Machine State data", {"timestamp"}, {"Machine State data.timestamp"}),
#"Added Custom" = Table.AddColumn(#"Expanded Machine State data", "Custom", each [Machine State data.timestamp]>=[SHIFT PERIOD START] and[Machine State data.timestamp]<=[SHIFT PERIOD END]),
#"Filtered Rows" = Table.SelectRows(#"Added Custom", each ([Custom] <> false))
in
#"Filtered Rows"
Pbix as attached.
Hi @Anonymous ,
We can merge tables based on Line name and filter the table based on the new custom column
let
Source = Table.NestedJoin(Shifts, {"LINE NAME"}, #"Machine State data", {"Line Name"}, "Machine State data", JoinKind.LeftOuter),
#"Expanded Machine State data" = Table.ExpandTableColumn(Source, "Machine State data", {"timestamp"}, {"Machine State data.timestamp"}),
#"Added Custom" = Table.AddColumn(#"Expanded Machine State data", "Custom", each [Machine State data.timestamp]>=[SHIFT PERIOD START] and[Machine State data.timestamp]<=[SHIFT PERIOD END]),
#"Filtered Rows" = Table.SelectRows(#"Added Custom", each ([Custom] <> false))
in
#"Filtered Rows"
Pbix as attached.
Frank:
Super Thanks for the DAX. THe .pbix file really helped as well so thank you for your time to make that. Now that i can see the method I understand it. Your help has allowed us to use the Teams shift schedule to filter machine state data. This should improve my report data accuracy significantly. Thank you again for your help.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.