Forum Discussion
Using MAX to get most recent data
- Anonymous4 years ago
Hi SandeA ,
I created a sample pbix file(see attachment) for you, please check whether that is what you want. You can update the formula of measure [FilenameDB6Size] as below:
FilenameDB6Size = VAR _selfilename = SELECTEDVALUE ( Database6[FileName6] ) VAR _maxdate6 = CALCULATE ( MAX ( Database6[Date6] ), FILTER ( ALLSELECTED( Database6) , Database6[FileName6] = _selfilename ) ) RETURN CALCULATE ( MAX ( Database6[Size6] ), FILTER ( Database6, Database6[Date6] = _maxdate6 ) )If the above one can't help you get the desired result, please provide more sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.
How to upload PBI in Community
Best Regards
SandeA try this measure, change the column and table name as per your model.
Top Size =
SUMX (
Files,
VAR __file = Files[FileName]
RETURN
CALCULATE (
SUM ( Files[Size] ),
KEEPFILTERS(
TOPN (
1,
FILTER ( ALL ( Files ), Files[FileName] = __file ),
Files[Date],
DESC
)
)
)
)
✨ Follow us on LinkedIn and to our YouTube channel
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make effort 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.
- SandeA4 years agoHelper III
nope, still not correct, sorry. It now is showing a value of 577k. I don't think I want to use the TOPN because the current value isn't always the largest value. The sizes fluxuate. That is why I'm trying to get just the value for the most current day in the table. There is a job that updates the this table daily.