Power consumption

Hi,

I’m working on a app to calculate and monitor energy consumption of various buildings.

I’m facing some troubles to get the previous value of energy related to a specific building (I trying to get the column Last One).

Here is the expression I was trying :

INDEX(
SORT(
SELECT
(
Indexs[Index total];
AND(
[Date] = [_THISROW].[Date];
[ID Batiments] = [_THISROW].[ID Batiments];
[ID Energie] = [_THISROW].[ID Energie]
)
);
TRUE ); 1
)

But I’m only getting the actual “Index total”, is it a way to get the previous one ?

thanks to any help :slightly_smiling_face:

Hello @VictorB , yes, there is, your expression is 99% correct actually, just change [Index total] for [Last one] in your expression.

INDEX(
SORT(
SELECT
(
Indexs[Last one];
AND(
[Date] = [_THISROW].[Date];
[ID Batiments] = [_THISROW].[ID Batiments];
[ID Energie] = [_THISROW].[ID Energie]
)
);
TRUE ); 1
)

1 Like

It’s not working, the column [Last one] is where i’m typing the expression.

I understand, try this expression then:

INDEX(
SORT(
SELECT
(
Indexs[Index total],
AND(
[Date] < [_THISROW].[Date],
[ID Batiments] = [_THISROW].[ID Batiments],
[ID Energie] = [_THISROW].[ID Energie]
)
),
TRUE ), 1
)

1 Like

LOOKUP(MAXROW())

https://help.appsheet.com/en/articles/2357309-lookup

https://help.appsheet.com/en/articles/2357310-maxrow

https://community.appsheet.com/t/faq-filter-lookup-maxrow-minrow-ref-rows-and-select/24216

1 Like