Get the value of the precedent day in a pivot table
IIUC you can check for your conditions with pd.Series.where:
pt = raw.pivot_table(index=['GROUP_ID', 'DATE'], columns=['NAME'], values=['VALUE'])

s = pt[&quot;VALUE&quot;].groupby(level=0)[&quot;C&quot;].shift()

pt[(&quot;VALUE_PREV&quot;,&quot;C&quot;)] = s.where(s.notnull(), np.NaN)

print (pt)

                    VALUE            VALUE_PREV
NAME                    A     B    C          C
GROUP_ID DATE                                  
123456   2020-07-01  10.0  25.0  0.0        NaN
         2020-07-02  17.0  23.0  NaN        0.0
789012   2020-07-02  11.0  19.0  NaN        NaN
         2020-07-03   8.0  21.0  NaN        NaN