Forum Discussion

Jmenas's avatar
Jmenas
Icon for Advocate III rankAdvocate III
9 years ago
Solved

Day to day difference in cumulative values DAX or Power Query

Hi All,   I am trying to build a measure o a column that is telling me the difference between today and yesterday. The issue with the data is that is cumulative. That means if I have a column like ...
  • v-ljerr-msft's avatar
    9 years ago

    Hi Jmenas,

     

    According to your description above, I would suggest you use the formula below to create a new calculate column in your table in this scenario. :smileyhappy:

    Cost(Daily) = 
    VAR costPreviousDay =
        CALCULATE (
            SUM ( Products[Cost] ),
            FILTER (
                ALL ( Products ),
                Products[Date]
                    = EARLIER ( Products[Date] ) - 1
                    && Products[Container Type] = EARLIER ( Products[Container Type] )
            )
        )
    RETURN
        Products[Cost] - costPreviousDay
    

     

    Regards