Creating a calculated field for the month with the highest sales:


The formula doesn’t work.

Hi @jcolucci - To try your scenario, i used a test dataset with Sales and Date as two columns. I then created three calculated fields:
c_sum_sales_by_month = sumOver(Sales,[date],PRE_AGG)
c_max_sales = maxOver({c_sum_sales_by_month },,PRE_AGG)
c_month_with_max_sales = ifelse({c_sum_sales_by_month }={c_max_sales },date,null)

Then i can plot c_month_with_max_sales as KPI. Is this what you were trying to achieve?

1 Like

What is the formula for calculating the highest sales figure of the year?

How do I create a formula to get the maximum monthly sales for the year in quicksight?

I used this formula: maxOver({Operation_amount_USD}), [{Month}], PRE_AGG)
to get the result of the highest monthly sales value in the year by the following filters: Customer, by currency and payment method. However, it repeats the same value for all customers, which is not correct because each customer has their own maximum value for the year according to their sales.

Hello @jcolucci, if you need the maximum value to be different per customer, than your customer field will need to be added into the partition of the maxOver function:

maxOver({Operation_amount_USD}), [{Month}, {Customer}], PRE_AGG)

That should resolve the issue you are facing!

Hello Dylan, good afternoon!
The problem has been solved, thank you very much!!!

1 Like