Best Answer and it helped me too.
IF( HASONEVALUE('Table'[Quarter]), CALCULATE(AVERAGE('Table'[Sales]), ALL('Table'), VALUES('Table'[Quarter])))