Heres a few options. I know you said you figured it out but just in case other people want to know. Ive spent the past few months learning the ins and outs of BQL because I dont want to use helpdesk as a crutch.
Hit me up if you have any q's. I dont work for them.
Avg for past 30 days:
avg(dropna(px_volume(dates=range(-30d, 0d))))/1M
Avg for 30 days, for a given startdate/enddate:
avg(dropna(px_volume(dates=range(2022-01-01, 2022-01-31))))/1M
You can also use a startdate or enddate with a range:
avg(dropna(px_volume(dates=range(2022-01-01, +30d))))/1M
or
avg(dropna(px_volume(dates=range(-30d, 2022-01-31))))/1M
On a rolling basis
rolling(avg(dropna(px_volume(dates=range(0d, 30d))))/1M, iterationdates=range(2022-01-01, 2022-01-02))
or range(-1Y, 0D).
I used dropna() because you want to drop out the non-trading days. If you want to count non-trading days as zero use znav().