Calculating a sum based on the date from another table

Use:

#convert columns to datetimes
df_invoices['Issued'] = pd.to_datetime(df_invoices['Issued'], dayfirst=True)
df_changes['ChangeDate'] = pd.to_datetime(df_changes['ChangeDate'], dayfirst=True)

#added column for compare with greater
df_invoices['ChangeDate'] = df_invoices['Client'].map(df_changes.set_index('Client')['ChangeDate'])

df_invoices['g'] = np.where(df_invoices['ChangeDate'].gt(df_invoices['Issued']), 'BeforeChange','AfterChange')

#pivoting with aggregate sum
df1 = df_invoices.pivot_table(index='Client', columns='g', values='NetTotal', aggfunc='sum')
#added total aggregation sum with before after column
df = df_changes.join(df_invoices.groupby('Client')['NetTotal'].sum(), on='Client').join(df1, on='Client')
print (df)
  Client ChangeDate  NetTotal  AfterChange  BeforeChange
0      A 2021-01-02      3500         2500          1000
1      B 2021-01-06      3500         2000          1500