Media de Vendas dos ultimos 7 dias

Bom dia Pessoal!

Como faço um campo calculado que me traga a média de vendas dos ultimos 7 dias sem contar com o dia atual?

Obrigado.

Oii @Andre_Augusto_Vieira, apenas uma dica pra você:
tente sempre fazer perguntas aqui em inglês para ter mais alcance de resposta.

Para calcular a média de vendas dos últimos 7 dias, excluindo o dia atual, você pode tentar algo como:
avgIf( {Vendas}, {Data} >= addDateTime(-8, 'DD', truncDate('DD', now())) AND {Data} < truncDate('DD', now()) ) .
Nesta fórmula, {Vendas} é o campo de vendas e {Data} é o campo de datas. A função addDateTime(-8, 'DD', truncDate('DD', now())) calcula a data de 8 dias atrás, enquanto truncDate('DD', now()) obtém a data de hoje sem a hora, garantindo que o dia atual não seja incluído. Salve o campo calculado para usá-lo em suas visualizações.
Se te ajudar, por favor, pode classificar como solução? me ajuda a crescer na comunidade.

[EN]
To calculate the average sales of the last 7 days, excluding the current day, you might try something like: avgIf( {Sales}, {Date} >= addDateTime(-8, 'DD', truncDate('DD', now())) AND {Date} < truncDate('DD', now()) ). In this formula, {Sales} is the sales field and {Date} is the date field. The function addDateTime(-8, 'DD', truncDate('DD', now())) calculates the date 8 days ago, while truncDate('DD', now()) gets today’s date without the time, ensuring the current day is not included. Save the calculated field to use it in your visualisations.

It worked, thank you very much.

Now could you help me with another question? How do I make a field to place in the reference line that only looks for the previous day’s total sales?

could be something like this:
sumIf({Vendas}, dateDiff({Data}, now(), ‘DD’) = 1)

please, flag my answers as a solution if it helps you

This didn’t work.

It is not bringing the value of 02/04/2025 which would be 7904, it is breaking the value into two days and adding them together does not add up either.