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). 

screenshot.png

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 ๐Ÿ™‚

Solved Solved
0 4 70
1 ACCEPTED SOLUTION

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
                    )

View solution in original post

4 REPLIES 4

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
                    )

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
                    )

Top Labels in this Space