Dynamic grouping based on report's parameters allows users to change the grouping criteria of data in shared/published/embedded reports. This enables users to create more personalized and context-specific reports by selecting how they want data to be grouped - without having to create many similar reports (for each of these grouping options).
How dynamic grouping works in a report:
 
	 Expression:
		Expression:
		Sql.Raw(
  new dictionary{
    {"Year", "EXTRACT(YEAR FROM order_date)"},
    {"Month", "EXTRACT(MONTH FROM order_date)"},
    {"Day", "EXTRACT(DAY FROM order_date)"}
  }[ IfNull(Parameter["param_group_by"], "Year")]  )
		Sql.Raw function is used to insert the value into SQL query 'as-is' (not as a constant).new dictionary{} defines SQL expressions for allowed "param_group_by" choices and also guarantees that user-entered 
		value is not inserted into SQL directly (to prevent a possibility of SQL-injections).
	 Expression:
		Expression:
		new dictionary{
    {"Year","{0}"},
    {"Month","{MMM}"},
    {"Day", "{0}"}
  }[ IfNull(Parameter["param_group_by"], "Year")]
	 
		@param_group_by which means that it is resolved with parameter's value.
		Format = @param_group_by_fmt (keep it empty if format doesn't depend on the user's grouping criteria selection).
		Parameters = @param_group_by_sql which defines a custom SQL expression for this dimension that is resolved from the parameter's value.