If you trust this link, click it to continue.
https://www.helicalinsight.com/changing-groupby-clause-of-the-report-based-on-dropdown-value/