Forum Discussion
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?
5 Replies
- lbendlinSuper 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".
- lcaseyPost Prodigy
Its a text field. I ended up using a table as the slicer so I can show the months that are closed:
- amitchandakSuper 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)) - parry2kSuper 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.⚡
- v-henryk-mstfCommunity 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”.
Best Regards,
HenryIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.