How to use different LAC aggregations with the same calculated field in different visuals based on dimension context in Quick Sight?

I’m trying to achieve different aggregations on the same calculated field in Quick Sight depending on the visual context.

Here’s the scenario:
I have an id column, and I want to use it differently based on the dimension in the visual:

  • When viewing the data by date, I want to show the distinct count of id.
  • When viewing the data by category, I want to show the average of daily distinct id counts.

Is it possible to use one calculated field (possibly using LAC-A functions) that dynamically adapts based on the visual’s dimension context? Or do I need to create separate calculated fields for each case?

Any guidance or best practices would be appreciated!

Hi @Subhash_Malvi,
Normally when you create a calculated field, you’re defining the type of calculation you’d like to achieve, therefore the aggregation type shows ‘custom’ on a calculated field and does not allow you to apply any other type of aggregation.

I would suggest that the best practice here would be to create 2 separate calculated fields.

Let me know if you have any additional questions.

Hi @Subhash_Malvi,
Following up here as it’s been awhile since we last heard from you on this thread; did you have any additional questions regarding your initial post?

If we do not hear back within the next 3 business days, I’ll close out this topic.

Thank you

Hi @Subhash_Malvi,
Since we have not heard back, I’ll go ahead and close out this topic. However, if you have any additional questions, feel free to create a new post in the community.

Thank you