Forum Discussion
renanc
Helper II
4 years agoCalculate the values between two lines
Hi everybody, I have a calculated value on Dax, but it calculates the value between the current fuel fill and the next one. I want to calculate the value between the current fuel fill and the previou...
- 4 years ago
Hi Anonymous I found the solution for this case, it was:
KM Anterior =VAR Ultimo_Checklist =CALCULATE(MAX(fChecklists2[IdChecklist]),FILTER(ALL(fChecklists2),(fChecklists2[DescPlaca])=EARLIER([DescPlaca])&& fChecklists2[IdChecklist] < EARLIER([IdChecklist])&& fChecklists2[IdQuestionario] = EARLIER([IdQuestionario])&& fChecklists2[DtCadastro] <= EARLIER([DtCadastro])))VAR KM_Anterior =CALCULATE(MAX(fChecklists2[Digite a KM]),FILTER(ALL(fChecklists2),fChecklists2[IdChecklist] = Ultimo_Checklist))RETURNKM_Anterior
Anonymous
4 years agoNot applicable
Hi renanc ,
Please share some sample data so that we could test the formula on it.
Best Regards,
Jay
- renanc4 years ago
Helper II
Hi Anonymous I found the solution for this case, it was:
KM Anterior =VAR Ultimo_Checklist =CALCULATE(MAX(fChecklists2[IdChecklist]),FILTER(ALL(fChecklists2),(fChecklists2[DescPlaca])=EARLIER([DescPlaca])&& fChecklists2[IdChecklist] < EARLIER([IdChecklist])&& fChecklists2[IdQuestionario] = EARLIER([IdQuestionario])&& fChecklists2[DtCadastro] <= EARLIER([DtCadastro])))VAR KM_Anterior =CALCULATE(MAX(fChecklists2[Digite a KM]),FILTER(ALL(fChecklists2),fChecklists2[IdChecklist] = Ultimo_Checklist))RETURNKM_Anterior