Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
etalon
Frequent Visitor

Alternative to LOOKUPVALUE

I have got this to work, but I really don't like how I have done it, and was wondering if there was a better way?

 

I have two tables:

 

  1. TankID: contains the unique tank ID plus related information on the tank
  2. FuelLevels: contains three columns-  TankID, Date/Time, FuelLevel

 

I have a new calculated column in tankID, whos job it is to get the latest fuel level for that tank from FuelLevels.

 

I have a relationship set up on TankID, (one to many, single way filtering)

 

calculated column is: 

 = lookupvalue(FuelLevels[Value],FuelLevels[Date/Time],calculate(max(FuelLevels[Date/Time])),FuelLevels[TankID],[TankID])

 

Logic: searching the FuelLevels table:

 

  • search column: date/time. Find the latest date/time, and search for this value

 

I dont really like this part, it seems messy, but it works.

 

 

  • Search tankID column in FuelLevels, search for the current TankID.

 

I really dont like this, as it seems superflous. (this should be done by relationships?)

 

Can someone tell me how to do this better!!

 

Many thanks

 

*edit*

I want to use something like this:

 = FILTER(FuelLevels,MAX([Date/Time])), but this obviously returns a table with multiple columns, I dont know how to just pull out just the fuel levels one (and ensure I only get one result)
1 ACCEPTED SOLUTION
v-lili6-msft
Community Support
Community Support

hi, @etalon 

For your requirement, you could try this formula:

Column 2 = var _maxdatetime=CALCULATE(MAX(FuelLevels[Date/Time])) return
CALCULATE(SUM(FuelLevels[Value]),FuelLevels[Date/Time]=_maxdatetime)

9.JPG

 

Best Regards,

Lin

 

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-lili6-msft
Community Support
Community Support

hi, @etalon 

For your requirement, you could try this formula:

Column 2 = var _maxdatetime=CALCULATE(MAX(FuelLevels[Date/Time])) return
CALCULATE(SUM(FuelLevels[Value]),FuelLevels[Date/Time]=_maxdatetime)

9.JPG

 

Best Regards,

Lin

 

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.