Last Record from a table of records

I have a table-Tbl1 with Multiple Rows of data by [Date] for a Column Item
I would like to make a Report or Newtable-Tbl2 with the last know data for that Column Item

I am adding new records every day to this table

Thanks for your help

Solved Solved
0 24 5,067
1 ACCEPTED SOLUTION

Thanks Steve.
I changed _ROWNUMBER to โ€œDateโ€โ€ฆThanks to @Marc_Dillon

SOLVED

([_THISROW] = MAXROW(โ€œWell Testsโ€, โ€œDateโ€, ([_THISROW].[Well Name] = [Well Name])))

View solution in original post

24 REPLIES 24

Steve
Platinum 4
Platinum 4

I understand MaxROW()
I created a slice as Table and tried using MAXROW() function.
The MAXROW() expression does not work with a slice

How do I go about using Maxrow?

A slice is actually easier. Use a row filter expression like this:

(MAX(Tbl1[_ROWNUMBER]) = [_ROWNUMBER])

I have the Table with ID, Date, O, W,G
It has several rows with same ID, but the Date is different for each row.
The Date can be same for different ID.

I want to get the last entry for each ID
I used the Filter (MAX(Well Tests[_ROWNUMBER]) = [_ROWNUMBER])
It only gives me 1 ID and not for the last date that ID has data, but the last row the table.

I read this MAXROW(โ€œEventsโ€, โ€œDateโ€, ([Date] < DATE(โ€œ1/1/โ€ & YEAR(TODAY()))))โ€ฆreturns the row for the most recent event prior to this year
I want the table only the LATEST ENTRY of ID

Table Name: Well Tests
Column Headings:

|UniqueID|Well Name|API|Section|Date|Oil|Gas|Water|Hours On|%|SITP|SICP|FTP|FCP|24hr Oil|24hr Gas|24hr Water|Choke|Test Method|Allocate?|Notes|

Thanks
Amol!

Tbl-WellTest|690x316

Try:

([_THISROW] = MAXROW("Tbl1", "_ROWNUMBER", ([_THISROW].[ID] = [ID])))

i tried mimicing this

Replace ID with whatever you were referring to with โ€œIDโ€ in the above.

ID was โ€œWell Nameโ€
It still gives me multiple rows of same Well Name

([_THISROW] = MAXROW(โ€œWell Testsโ€, โ€œ_ROWNUMBERโ€, ([_THISROW].[Well Name] = [Well Name])))

Letโ€™s try this, then:

([key-column] = MAXROW(โ€œWell Testsโ€, โ€œ_ROWNUMBERโ€, ([_THISROW].[Well Name] = [Well Name])))

replacing key-column with the name of the key column for the Tbl1 table.

I tested again, the last one before this _THISROW solution works better
Thanks for your very kind help.

([_THISROW] = MAXROW(โ€œWell Testsโ€, โ€œ_ROWNUMBERโ€, ([_THISROW].[Well Name] = [Well Name])))

This gives me LastROW.
Would like to get the most recent well test, based on Date.

Thanks,
Amol

I encourage you to read the MAXROW() documentation I posted earlier in the thread. You requirement can be met with a small change in the expression.

Thanks Steve.
I changed _ROWNUMBER to โ€œDateโ€โ€ฆThanks to @Marc_Dillon

SOLVED

([_THISROW] = MAXROW(โ€œWell Testsโ€, โ€œDateโ€, ([_THISROW].[Well Name] = [Well Name])))

I was really hoping this MAXROW expression of mine would work for a slice I am using simply to display the most recent office hourโ€ฆ

MAXROW(โ€œOffice Hoursโ€, โ€œ_RowNumberโ€, [kot]=USEREMAIL())

[kot] refers to manager (name) key being emailโ€ฆ

it check outs in expression but doesnโ€™t work for the slice, i tried all sorts of variations but โ€ฆ this should work in my mind!

โ€ฆwe have one table of Office Hours, I want the most recent entry for the current user

Try using the form in the topicโ€™s solution:

YESSSS SIRR!!!

Hi Steve
How can I get data only for EOMONTH()

Thanks Buddy!
You are a trooper

Regards,
Amol

I donโ€™t understand. Please elaborate.

Thanks Steve
I am going to write another question, since its not related to this Table.

Thanks
Amol

The answer in MAXROW is โ€œTrueโ€ or โ€œfalseโ€. How do I get the selected coloumn value of the last row in the table there? This is my equation. I applied this to the initial value. The answer is false.

[_THISROW] = MAXROW(โ€œstock pileโ€, โ€œ_ROWNUMBERโ€,([_THISROW].[Stockpile No] = [Stockpile No]))

3X_6_e_6e8228a0bef62dd4508af5553bbb086255e45a26.png

Can you help me?

Great. Fantasticโ€‹:+1:

Dear sir, I have a table called as Patient Monitoring. I have created an application in which a care giver visits customers and logs details , I want to display the date of the last record that he entered for this one particular customer. I have been using this forumula

LOOKUP( MAX( SELECT( Patient Monitoring[_ROWNUMBER], ([_THISROW].[Phone Number] = [Phone Number]) ) ), "Patient Monitoring", "_ROWNUMBER", "Current Visit Date") 

I tried and get an error

EXPRESSION ASSISTANT

([_THISROW] = MAXROW(โ€œWell Testsโ€, โ€œ_ROWNUMBERโ€, ([_THISROW].[ID] = [ID])))

Error in expression โ€˜[_ComputedKey].[ID]โ€™ : Unable to find column โ€˜IDโ€™

Top Labels in this Space