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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Obtain the last value in a column?

So I have a table with [Tickers] as one column which has about 5 or 6 stock tickers. I also haved a date column which just has weekdays (or when the stock market is open) as this is the data that is pulled in related to the stock tickers. Then I have various columns with calculations based on the data.

 

So I have some calculations that produce the total value of a stock, but I want to display in my visuals the last value (or last date) for that particular stock instead of the sum of the entire column. I know I can set a relative date filter to go back one day, but this does not really work on the weekend when one day ago was still the weekend so it filters for no data. 

 

My solution was to kind of create an index column based on the [Tickers] column. Then I could create a measure to pull the MAX of the last non-blank value to get what I am looking for. So what I wanted to do was create a running index for each unique ticker in one column. I don't believe I can do this with the standard Index column function in Power BI. I thought a workaround would be to use the Rank function based on the date column for each unique ticker. However, I am stumped on how to rank the date column while filtering for each unique ticker in the [Ticker] column. Would anyone know how to solve this issue?

1 ACCEPTED SOLUTION
Zubair_Muhammad
Community Champion
Community Champion

Hi @Anonymous

 

Add this calculated column to the Table. It will RANK dates for each ticker separately.

Then you can Filter or Slice by RANK 1 to get the last value

 

RANK =
RANKX (
    FILTER (
        ALL ( TableName ),
        TableName[Tickers] = EARLIER ( TableName[Tickers] )
    ),
    TableName[Date],
    ,
    DESC,
    DENSE
)

View solution in original post

2 REPLIES 2
Zubair_Muhammad
Community Champion
Community Champion

Hi @Anonymous

 

Add this calculated column to the Table. It will RANK dates for each ticker separately.

Then you can Filter or Slice by RANK 1 to get the last value

 

RANK =
RANKX (
    FILTER (
        ALL ( TableName ),
        TableName[Tickers] = EARLIER ( TableName[Tickers] )
    ),
    TableName[Date],
    ,
    DESC,
    DENSE
)

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors