Formula for monthly consumption

I have the following table to record water meter readings each month.  There are 4 different meters in the table shown below, each with a different number of readings.

consumo.jpg

I'm trying to calculate the consumption between the current reading and the previous reading for each meter, as well as the number of days different between the two readings.  I'd like to store this in the same row as the most current reading/entry for that meter (medidor).

I know it's a simple subtraction, but I can't figure out how to select the previous data for the same medidor.

Table and view are shown for additional information as well:

appsheet.jpg

view.jpg

Solved Solved
0 2 256
1 ACCEPTED SOLUTION

  1. Add a new column: "lecturaAnterior" to your table, so that with each new row you also calculate the key of the previous reading of the same meter. Its App Formula would be:
      MAXROW("readingsTableName", "Fecha", AND(
        [Medidor] = [_ThisRow].[Medidor],
        [Fecha] < [_ThisRow].[Fecha]
      ))
  2. Make this column a Ref pointing to the same table.
  3. You can then easily calculate el consumo puntual asรญ:
      [Lectura] - [lecturaAnterior].[Lectura]
  4. And "Dรญas" asรญ:
      [Fecha] - [lecturaAnterior].[Fecha]

View solution in original post

2 REPLIES 2

  1. Add a new column: "lecturaAnterior" to your table, so that with each new row you also calculate the key of the previous reading of the same meter. Its App Formula would be:
      MAXROW("readingsTableName", "Fecha", AND(
        [Medidor] = [_ThisRow].[Medidor],
        [Fecha] < [_ThisRow].[Fecha]
      ))
  2. Make this column a Ref pointing to the same table.
  3. You can then easily calculate el consumo puntual asรญ:
      [Lectura] - [lecturaAnterior].[Lectura]
  4. And "Dรญas" asรญ:
      [Fecha] - [lecturaAnterior].[Fecha]

Once again, that worked.  Thank you!~

Top Labels in this Space