You cannot refer to a column alias in the same SELECT clause - you either need to reproduce the formula:
SELECT t1.a,
t2.d * t2.f AS m,
SUM(t2.d * t2.f)
FROM table1 AS t1
JOIN table2 AS t2 ON t1.a = t2.a
GROUP BY t1.b
.. or use a view / inline view:
SELECT x.a,
x.m,
SUM(x.m)
FROM (SELECT t1.a,
t2.d * t2.f AS m
FROM table1 AS t1
JOIN table2 AS t2 ON t1.a = t2.a
GROUP BY t1.b) x
MySQL - GROUP BY (HAVING ORDER BY ). ORDER BY.