I have been trying to perfom a dax calculation without success. My objective is to obtain the average of the column [Média de Preco] considering some filters, which I was able to do with the code bellow.
MediaPB_Band_AI_Dia =
CALCULATE(
dPBomba_AI_FL[.PBomba_Medio];
ALLEXCEPT(dPBomba_AI_FL;
dPBomba_AI_FL[Data Coleta];
dPBomba_AI_FL[Área de Influência];
dPBomba_AI_FL[Combustivel];
dPBomba_AI_FL[Bandeira]
)
)The problem is that I need to also calculate for each row the same expression considering the previous day. That means: to obtain the average price of a set of filters, but filtering not the day expressed in the same row, but the equivalent of the previous day.
I have already tried some codes, without sucess, like:
∆PBMedio%_Dia =
CALCULATE(
AVERAGE(dPBomba_AI_FL[Média de Preco]);
dPBomba_AI_FL[Data Coleta]-1;
ALLEXCEPT(
dPBomba_AI_FL;
dPBomba_AI_FL[Área de Influência];
dPBomba_AI_FL[Combustivel];
dPBomba_AI_FL[Bandeira]
)
)Could you please help me accomplish this?
Thank you,
Bruno