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
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))

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
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.