The "Total by" function allows a Cube to be aggregated at a higher level than the Entities in the Axes area. This function is particularly useful for calculating percentages and other indicators.
Example:
Consider the report below, where:
The City Entity has been added by row.
The first column shows sales values.
The second column shows sales values with the "Total by" function applied on the State Entity. This configuration returns the total sales value for each State the corresponding city belongs to.
The third column calculates the percentage of sales for each city against the total sales for the State it belongs to.

Here's the configuration in the Layout Editor:

As you can see, the "Total by" function allows Block "b" values to be shown at a higher level of aggregation than the Entity City set by row, thus allowing an easier calculation of the percentage in Block "c".