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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
lcasey
Post Prodigy
Post Prodigy

Get specific column from Last record

Hello,

 

I have a table that I would like to find the last record and specifically show the "Closed Month" Field.   The measure should only display the word Oct-2021 because that is the last record with the "Closed" column set to Yes based on the DateKey.

 

Measure = CALCULATE(MAX(FY[Closed Month]),ALL(FY),FY[Closed] = "Yes")  Doesnt work.   

 

Does anyone lknow how to achieve this?

 

1.png

5 REPLIES 5
v-henryk-mstf
Community Support
Community Support

Hi @lcasey ,

 

According to your needs, you want to get the latest records based on the "Yes" in the Closed column. I did the following test: note that ALLSELECT function keeps the slicer external filter and the created measure is added to the Card to return the latest record under “Yes”.

v-henryk-mstf_1-1609834325553.jpeg

 

Best Regards,
Henry

 

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

parry2k
Super User
Super User

@lcasey I don't why you are using ALL() in your measure

 

try this, it doesn't work share sample data:

 

Measure = CALCULATE(MAX(FY[Closed Month]),KEEPFILTERS(FY[Closed] = "Yes"))

 

Check my latest blog post Year-2020, Pandemic, Power BI and Beyond to get a summary of my favourite Power BI feature releases in 2020

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

amitchandak
Super User
Super User

@lcasey, Test as

Medidas ?
var _max - MAXX(filter(Allselected(FY),FY[Closed] á "Yes"), FY[DateKey])
devolución
CALCULATE(MAX(FY[Closed Month]),Filter(Allselected(FY), FY[Closed] á "Yes" && [DateKey] á _max))

O


Medidas ?
var _max - MAXX(filter(all(FY),FY[Closed] á "Yes"), FY[DateKey])
devolución
CALCULATE(MAX(FY[Closed Month]),Filter(all(FY), FY[Closed] á "Yes" && [DateKey] á _max))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
lbendlin
Super User
Super User

is your [Closed Month] field a text field or a Date field?  It needs to be a Date field  if you want the logic to work - you can still format it in the way you need.

 

The [Date Key] field is equally suspicious.  Use actual numbers like 202001 instead of text "2020-1".

Its a text field.  I ended up using a table as the slicer so I can show the months that are closed:

 

lcasey_0-1609375850912.png

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.