Late filtering

Let's say you've built a view that allows you to see the percent of total sales for each department. You have already used a Quick Table Calculation on the Sales field to give you the percent of the total. You've also used Department as a filter. But this presents a problem.

Since Table Calculations are performed after the aggregate data is returned to the cache, the filter on department has already been evaluated at the data source and the aggregate rows don't include any departments excluded by the filter. Thus, the percent of the total will always add up to 100%; that is, it is the percentage of the filtered total, as shown in the following screenshot:

What if you wanted to see the percentage of the total sales for all departments, even if you want to exclude some from the display? One option is to use a Table Calculation as a filter.

If you create a calculated field called Department (late filter) with the code LOOKUP(ATTR([Department]), 0) and place that on the Filters shelf instead of the Department dimension, then the filter is not applied at the source, the aggregate data is visible to other Table Calculations, and the Table Calculation filter merely hides departments from the final view, as shown in the following screenshot:

You might have noticed the ATTR function used. Remember that Table Calculations require aggregate arguments. ATTR (which is short for attribute) is a special aggregation that returns the value of a field if there is only a single value of that field present for a given level of detail or a * if there is more than one value.

To understand this, experiment with a view having both Department and Category on Rows. Using the drop-down menu on the active field in the view, change Category to Attribute. It will display as * because there is more than one category for each department. Then, undo and change Department to Attribute. It will display the department name because there is only one department per category.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.139.107.210