Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

calculate current month vs previous month

Hi,   I need some help on this, I'm pretty new to PBI.   I have a list of meter readings and I want to automatically calculate the usages in each month. The list will be updated on monthly basis...
  • Greg_Deckler's avatar
    Greg_Deckler
    4 years ago

    Anonymous Yes! So now you can do this:

    Usage Column = 
      VAR __CurrentValue = [Value]
      VAR __Meter = [Attribute]
      VAR __Date = [Datum meteropname]
      VAR __PreviosDate = MAXX(FILTER('Table',[Datum meteropname]<__Date && [Attribute]=__Meter),[Datum meteropname])
      VAR __PreviousValue = MAXX(FILTER('Table',[Datum meteropname]=__PreviousDate && [Attribute]=__Meter),[Value])
    RETURN
      __CurrentValue - __PreviousValue