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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Generate a column that contains only last 3 values from another column

Hello all,

I am fairly new to PowerBI and more specifically - DAX.I would like to know the following : is there a way to generate a column using DAX formula which  takes the values of  only the last 3 rows from another column? I will attach a screenshot of the expected result below.

Untitled.png

Thanks in advance for your help!

2 REPLIES 2
Whitewater100
Solution Sage
Solution Sage

Hi:

Maybe you can add an index column on this table via Power Query. TRANSFORM>ADD NEW COLUMN > INDEX COLUMN > Index from 1. The last three in your example are index 6-8. I'll call your table "Data".

 

Then you can do an IF statement.

Result = IF(Data[Index] IN { 6, 7, 8}, Data[Value], BLANK()).

 

You can also use TOPN to make a table.

 

Bottom 3 Index Values = TOPN(3, VALUES(Data[Value]), 

                                        CALCULATE(SUM(Data[Index])), 
                                       DESC
                                                )

 

I hope this helps solve your question..

Anonymous
Not applicable

The index will be always changing.I think I didnt provide the right example,here is a better one  :

dsBuffer.bmp.png

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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