Forum Discussion

Ice_82's avatar
Ice_82
Frequent Visitor
3 years ago
Solved

Difference with previous data available

Hi,

I have to calculate the difference with previuous data avaiable, but I dont' have a fix delta time:

amvaldelta
30/11/2022500067%
31/12/2021300050%
31/12/2020200067%
31/06/20201200 

 

With a defined period (11 moth) no problem

DELTA = (SUM(table[val])-CALCULATE(SUM(table[val]),PARALLELPERIOD(table[am],-11,MONTH)))/CALCULATE(SUM(table[val]),PARALLELPERIOD(table[am],-11,MONTH))

 

But if the period is not fixed which is the solution?

3 Replies

    • Ice_82's avatar
      Ice_82
      Frequent Visitor

      Sorry I simplified the real aggregation, my data are grouped in this way:

       

      amliv1flagvaldelta 
      30/11/2022group1a100043% 
        b1500114% 
       group2a100011% 
        b200067% 
      31/12/2021group1a70017% 
        b70040% 
       group2a90013% 
        b120020% 
      30/11/2021group1a600  
        b500  
       group2a800  
        b1000  

       

      In this situation, how can I modify your code?

      Thanks