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'm fairly novice in DAX and need help with the following forumla:
What i need is a measure that will display the latest (most recent date) hours for a specific unit and type:
If i wanted Unit 1 Type A, i would want it to display 1200 (this is the hours from the most recent entry)
MAX function will not work as the hours can be higher on ealier dates so i need the latest hours from the date/time
Date/Time | Unit | Type | Hours |
01/01/2020 1:00 | Unit 1 | A | 1000 |
01/02/2020 8:00 | Unit 2 | B | 500 |
01/10/2020 10:00 | Unit 1 | A | 1100 |
01/11/2020 8:00 | Unit 2 | A | 600 |
01/12/2020 8:00 | Unit 1 | A | 1200 |
HI @Anonymous,
You can use the following measure formula to get lastest hours based on the current unit and type group:
Lastest Hour =
VAR filtered =
CALCULATETABLE (
t3,
ALLSELECTED ( t3 ),
VALUES ( T3[Unit] ),
VALUES ( T3[Type] )
)
VAR _max =
MAXX ( filtered, [Date/Time] )
RETURN
MAXX ( FILTER ( filtered, [Date/Time] = _max ), [Hours] )
Regards,
Xiaoxin Sheng
@Anonymous
Try
VAR __id = MAX ( 'Table'[id] )
VAR __Type = MAX ( 'Table'[Type] )
VAR __date = CALCULATE ( MAX( 'Table'[date] ), ALLSELECTED ( 'Table' ), 'Table'[id] = __id,'Table'[Type] = __Type )
RETURN CALCULATE ( MAX ( 'Table'[value] ), VALUES ( 'Table'[id] ), 'Table'[id] = __id,'Table'[Type] = __Type , 'Table'[date] = __date )
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 |
---|---|
111 | |
100 | |
80 | |
64 | |
58 |
User | Count |
---|---|
146 | |
110 | |
93 | |
84 | |
67 |