Sure! Here is the English translation of your formatted question:
Issue with Duplicated Targets and Incorrect Subtotals When Calculating % Actual / Target in Quick Sight
Data Context:
I have two tables:
- Fact table: contains actual transaction data (
actual value) - Target table: contains sales targets (
target value), which is left joined to the fact table via thefull namefield.
Problem:
Since the target table is joined by full name, when a salesperson has multiple transactions, their target value is duplicated multiple times—once for each fact row.
Visual Requirement:
I’m building a pivot-style visual with two hierarchy levels:
- Level 1:
Group Sales - Level 2:
Sales Name(full name)
The visual displays the following metrics:
-
Actual Value → Calculated using
sum({actual})→
Correct -
Target Value → Due to duplication, I:
- Use
max()oravg()to get the unique target per salesperson - For subtotal rows at the Group Sales level, I manually configure the aggregate function in the UI to use SUM instead of the default max/avg →
Correct result
- Use
-
% Actual / Target → Calculated using:
sum({actual}) / max({target})- For individual salesperson rows:
correct - For subtotal rows (Group Sales) and Grand Total:
incorrect (because max({target})is no longer valid at that level)
- For individual salesperson rows:
Question:
-
Is there a way to calculate % Actual / Target such that:
It works correctly for individual salesperson rows
It also works correctly for subtotal rows and the grand total
-
Is there a better approach or a way to write a calculated field that automatically handles both normal and subtotal rows properly in Quick Sight?
Let me know if you also want the solution to be:
- A single calculated field that handles all levels
- Or a separated logic for detail rows vs subtotals

