Formula to show the latest fuel price?

Hi all, i need help please.

I have a table in glide that has a date column and a fuel price per litre column. I am trying to create a lookup on that table that would find the max date and then the corresponding fuel price. Then I can show this data on the frontend to the user so they always know what the latest fuel price is.

Can someone point me in the right direction in what I need to do to accomplish this?

Thank you in advance.

It’s a little bit cumbersome, but here is how you do it:

  • Create a multiple relation that matches the date column with itself.
  • Create a rollup column that takes the latest date via the multiple relation
  • Create a single relation that matches the latest date (rollup) with the original date column
  • Create a lookup column that takes the price via the single relation column.
1 Like

use the rollup column to find the latest date, then the if-else column: if the date is the latest date then row ID… now you can copy this row ID using a single value column to the sheet that needs relation… then relate that single value to the sheet with gas prices rowID

1 Like

That worked, thank you. I was then able to set a default value for my Fuel Price field in my add refuel form. So now it shows the latest price without the user having to add it manually. Brilliant.

Thank you for your reply.

Last bit to this.

I have a Fuel Station Table that lists the Fuel Station Details, like name, location, city etc. How would I add the latest fuel price from the refuels table to this table so i can show this on the fuel station details screen on the front end?

use my method lol… get the row ID and relate it … you must have a Gas station row ID in the price row

Thank you, I couldn’t quite understand your method. Could you show me in more detail maybe with screenshots on how to implement it please? :slightly_smiling_face:

is the price different for different gas stations? or does the latest price apply to all gas stations?

The price for Petrol is the same across all fuel stations but the price of diesel is different across all the fuel stations.

So I need to show both the Petrol Price and the Diesel price per litre on the Fuel Station detail page or as a default in the Fuel Price Field in the form. On the form i have s choice field that has the fuel types, so a user select the fuel type then the latest price could be shown in the Fuel Price field so he does not have to add it manually.

if is the same for all is easy… just follow my steps… for diesel … you need to add the row ID of the station when applying a new price…
or you can use Darren method, if you already have that working, and copy that price to the table where you have your Gas Stations… use Single Value column

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.