Automatically grab previous year value from another row within same Sharepoint List

Copper Contributor

 

Hi,

What I want to do is, within the same Sharepoint List, have each row show the value from the previous year, if available, if not available then to leave the cell blank.

 

This is how my data is structured:

 

kpi_idyearvalueprevious year value
measure012021100 
measure012022105 
measure022021225 
measure022022250 
measure032021560 
measure032022670 

 

 

This is how I want it to be displayed:

 

kpi_idyearvalueprevious year value
measure012021100 
measure012022105100
measure022021225 
measure022022250225
measure032021560 
measure032022670560

 

As far as I know, this cannot be done with lookup columns, but it must be something that can be achieved using a workaround - for example, with Power Automate/Flows.

 

Any help would be much appreciated.

 

1 Reply

@Craig1S yes this can be done with a flow. In my SharePoint list the Year column is a number column.

0-SP-List.png

 

1-Flow.png

 Get the last year with a compose using the expression add(outputs('Get_item')?['body/Year'],-1)

2-Flow.png

 

Add a filter query to the SharePoint get items usinf Title eq '{Title}' and Year eq '{Outputs of the LastYear compose}'

3-Flow.png

 

The get items will only bring back 1 item but you still need the apply to each and for the new row you've just created, update it with value selected from the get items  section of the dynamic content box.

4-Flow.png

 

5-SP-List.png

 

Rob
Los Gallardos
Microsoft Power Automate Community Super User