Hi @emilie_lujan, welcome to the QuickSight Community! It appears that your calculated field for the weighted average SERP position is correct, but maybe the problem lies in the application of filters and ensuring the KPIs and table use the same logic.
Here’s one approach on how to properly configure your filters and ensure accurate KPI results:
Step-by-Step Solution:
- Verify Calculated Field: Ensure your calculated field for the weighted average SERP position is correct:
Pseudocode (Syntax may vary)
(sum(Impressions * Position)) / sum(Impressions)
This should give you the weighted average position.
2. Create Binned Categories: Create a new calculated field to categorize the accounts into bins:
Pseudocode (Syntax may vary)
ifelse(
{Weighted Average Position} <= 3.99, '1-3.99',
{Weighted Average Position} <= 10, '4-10',
{Weighted Average Position} <= 20, '11-20',
'21+'
)
Replace {Weighted Average Position}
with the actual field name for the weighted average position.
- Apply Filters: Ensure the same calculated field is used consistently in both your table and KPIs.
- For the table, apply the calculated field directly.
- For the KPI, set up the filters to count the number of accounts in each bin.
- Count Accounts in Each Bin: Create a calculated field to count accounts:
Pseudocode (Syntax may vary)
countDistinct({Account ID})
Replace {Account ID}
with the unique identifier for your accounts.
5. Set Up KPI:
- Create a separate KPI for each bin.
- Apply a filter to each KPI to count the accounts in the corresponding bin.
Example Configuration:
- Weighted Average Position:
Pseudocode (Syntax may vary)
(sum(Impressions * Position)) / sum(Impressions)
- Position Bins:
Pseudocode (Syntax may vary)
ifelse(
{Weighted Average Position} <= 3.99, '1-3.99',
{Weighted Average Position} <= 10, '4-10',
{Weighted Average Position} <= 20, '11-20',
'21+'
)
- Count of Accounts:
Pseudocode (Syntax may vary)
countDistinct({Account ID})
- Filters for KPIs:
- KPI 1-3.99: Filter
Position Bins
= ‘1-3.99’ - KPI 4-10: Filter
Position Bins
= ‘4-10’ - KPI 11-20: Filter
Position Bins
= ‘11-20’ - KPI 21+: Filter
Position Bins
= ‘21+’
Common Issues to Check:
- Ensure Consistency: Ensure the calculated fields are consistently applied across your analysis.
- Aggregation Level: Make sure you are aggregating at the correct level (e.g., account level) in both the table and the KPIs.
- Data Type: Verify that the calculated fields are of the correct data type and format.
By following these steps, you should be able to accurately filter and display the weighted average positions and count the accounts within each specified range.
Here is a good article on level-aware calculations:
Also, try using the Amazon Q Assistant on the functions documentation page.
Build calculations with Generative BI
Another approach is using Generative BI, you can use natural language prompts to create calculated fields within QuickSight, as shown in the following image. For more information about calculated fields in analyses, see Adding calculated fields.
Did this solution work for you? I am marking this reply as, “Solution,” but let us know if this is not resolved. Thanks for posting your questions on the QuickSight Community!
In case you need further assistance with your problem, please create a sample dashboard with sample dataset showing your problem state using Arena and please create a new post, so we can look at it from a fresh perspective. (Details on using Arena can be found here - QuickSight Arena)