Forum Discussion
Sjmiller
2 years agoRegular Visitor
Difference between tables
Two table difference I am trying to calculate the difference between two tables that are only related to each other on date. The ultimate goal is to find the times where the actual time used in the ...
- 2 years ago
Sjmiller , check if this code can help
Difference = VAR CurrentDate = SELECTEDVALUE('LOG'[SRVDATE]) VAR CurrentCustID = SELECTEDVALUE('LOG'[cust_id]) VAR CurrentStaffName = SELECTEDVALUE('LOG'[StaffName]) VAR ApptValue = CALCULATE( SUM('Appts'[Hours]), FILTER( 'Appts', 'Appts'[ApptDate] = CurrentDate && 'Appts'[custid] = CurrentCustID && 'Appts'[StaffName] = CurrentStaffName ) ) VAR SValue = CALCULATE( SUM('LOG'[Hours]), FILTER( 'LOG', 'LOG'[SRVDATE] = CurrentDate && 'LOG'[cust_id] = CurrentCustID && 'LOG'[StaffName] = CurrentStaffName ) ) RETURN IF(ApptValue <> SValue, 1, 0)
swikritee_p
2 years agoResolver II
Sjmiller , check if this code can help
Difference =
VAR CurrentDate = SELECTEDVALUE('LOG'[SRVDATE])
VAR CurrentCustID = SELECTEDVALUE('LOG'[cust_id])
VAR CurrentStaffName = SELECTEDVALUE('LOG'[StaffName])
VAR ApptValue =
CALCULATE(
SUM('Appts'[Hours]),
FILTER(
'Appts',
'Appts'[ApptDate] = CurrentDate &&
'Appts'[custid] = CurrentCustID &&
'Appts'[StaffName] = CurrentStaffName
)
)
VAR SValue =
CALCULATE(
SUM('LOG'[Hours]),
FILTER(
'LOG',
'LOG'[SRVDATE] = CurrentDate &&
'LOG'[cust_id] = CurrentCustID &&
'LOG'[StaffName] = CurrentStaffName
)
)
RETURN IF(ApptValue <> SValue, 1, 0)Sjmiller
2 years agoRegular Visitor
This worked thanks!