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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
kattlees
Post Patron
Post Patron

Get value of column based on lastest date

I have a column with AcctNum, Insurance, Date, Status, Paid Date

Entries may look like this

123456        CB          12-14-18              PAID                   2-14-18
123456        MPA       1-16-18               REJECTED            2-16-18

123456        MBI        2-16-18               BILLED         

654321        CPA       1-15-18                BILLED

654321        CB          1-15-18               BILLED

 

I need to get the Insurance Value from the last entry

 

So for 123456, I would need to get MBI 

For 654321 I would get CB

1 ACCEPTED SOLUTION

If you add an index column and you data looks like the following:

 

Capture.PNG

 

Then to get the results you desire, then use the following formula:

Measure = 
CALCULATE(
    MAX(Table1[Insurance]),
    FILTER(Table1,Table1[Index] = MAX(Table1[Index]))
)

And you will get the correct results:

Capture1.PNG

View solution in original post

3 REPLIES 3
vega
Resolver III
Resolver III

I think you would have to add some sort of index that increases incrementally as you add entries. I don't believe DAX has a way to access the entry order of records. 

If I add an index column, what would it take to get the latest one?

If you add an index column and you data looks like the following:

 

Capture.PNG

 

Then to get the results you desire, then use the following formula:

Measure = 
CALCULATE(
    MAX(Table1[Insurance]),
    FILTER(Table1,Table1[Index] = MAX(Table1[Index]))
)

And you will get the correct results:

Capture1.PNG

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.