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.
I want to write a measure to return the most current value for an asset based on the last date available:
Table1 | ||
Asset ID | Value | Period |
A | 1500 | 1-Dec-20 |
A | 4500 | 1-Mar-21 |
A | 2000 | 1-Jun-21 |
B | 500 | 1-Dec-20 |
B | 150 | 1-Mar-21 |
B | 100 | 1-Jun-21 |
C | 600 | 1-Dec-20 |
C | 1000 | 1-Mar-21 |
C | 900 | 1-Jun-21 |
Result | ||
Asset Id | Current Value | Period |
A | 2000 | 1-Jun-21 |
B | 100 | 1-Jun-21 |
C | 900 | 1-Jun-21 |
Solved! Go to Solution.
@shelleye This is Lookup Min/Max, like this:
Measure Lookup Max Simple =
VAR __Table = 'Table1'
VAR __Max = MAXX(__Table,[Period])
RETURN
MAXX(FILTER(__Table,[Period] = __Max),[Value])
@shelleye No problem, I actually grabbed that from my test PBIX for my external tool, Microsoft Hates Greg's Quick Measures. I have 4 different lookup min/max formulas in there that make these kinds of calculations a breeze.
@shelleye This is Lookup Min/Max, like this:
Measure Lookup Max Simple =
VAR __Table = 'Table1'
VAR __Max = MAXX(__Table,[Period])
RETURN
MAXX(FILTER(__Table,[Period] = __Max),[Value])
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
115 | |
100 | |
88 | |
69 | |
61 |
User | Count |
---|---|
151 | |
120 | |
103 | |
87 | |
68 |