Ad Widget

Collapse

Compare item value with old data

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Pascal_tg
    Junior Member
    • Jan 2020
    • 2

    #1

    Compare item value with old data

    Hi!

    We having big MFUs in office and Office Manager need to know daily and monthly printed pages quantity to calculate expenses.
    For this I need to compare item with it's one month old value.
    Formula I use for daily calculations: last(pages_printed_total) - last(pages_printed_total, #1, 1d)
    But it's not applicable for monthly calculation, as number of days may vary.
    So basically I just need to know how to change Day (d) to Month. Spent some time for googling this and reading through forum, but found nothing. Tried to use M, m, mo and so on - works only with m, but it indicates minutes, not months. Other statements make item unsupported.
    Is anybody know how to do this?
    Help is much appreciated.

    Thanks you!
  • Semiadmin
    Senior Member
    • Oct 2014
    • 1625

    #2
    In version 4.2 and above you may create LLD rule with JS in preprocessing to obtain the number of days in the current month. This LLD rule has to return two LLD macros, a macro for the number of days and some unchanging macro. In LLD rule create a prototype for your calculated item with "number of days" macro in formula and unchanging macro in key. In the prototype's name may be any of these two macros.

    Comment

    • Pascal_tg
      Junior Member
      • Jan 2020
      • 2

      #3
      I'll try to create item with custom interval scheduled to "00:01 AM, 1st day of the month" and another item comparing it's last and previous values.

      Comment

      Working...