Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I am trying to create a new calculated column across two of my current tables. Table 1 has the fields of "MachineID", "Start Time" and "End Time". The start and end times here are usually 12 hours apart and they are representing the entire shift structure.
Table 2 has some material usage information, which has a similar "MachineID" column, as well as start and stop times at more frequent intervals, usually 15 minutes, and a total material usage column.
What I am trying to do is do a calculated column that sums the 15-minute intervals on Table 2 when the MachineID matches and the timeframes in Table 2 are between the start and stop times of my total shift in Table 1.
Times are in Date/Time format in both tables
I tried to do this calculed column in Table 1:
TotalMtlUsage = CALCULATE(sum(Table2[Totals]), Table2[MachineID]=Table1[MachineID], Table2[StartTime]>=Table1[StartTime], Table2[EndTime]<=Table1[EndTime])
but it is giving me errors saying "The expression contains columns from multiple tables, but only columns from a single table can be used in a True/False expression that is used as a table filter expression".
Can anyone give me some suggestions or a better way to do this?
Solved! Go to Solution.
@haefnja , Try a new column like
TotalMtlUsage = CALCULATE(sum(Table2[Totals]),filter(Table2, Table2[MachineID]=Table1[MachineID] && Table2[StartTime]>=Table1[StartTime] && Table2[EndTime]<=Table1[EndTime]))
@haefnja , Try a new column like
TotalMtlUsage = CALCULATE(sum(Table2[Totals]),filter(Table2, Table2[MachineID]=Table1[MachineID] && Table2[StartTime]>=Table1[StartTime] && Table2[EndTime]<=Table1[EndTime]))
User | Count |
---|---|
76 | |
75 | |
46 | |
31 | |
27 |
User | Count |
---|---|
99 | |
91 | |
51 | |
49 | |
46 |