Forum Discussion
AThom
5 years agoNew Member
Select a value from a column based on another value from column.
I would like a measure that will select the the [Target -21/22] value based on the last value in the [21/22 - YTD] column. Can I get help with DAX that would acheiev this?
- 5 years ago
Ha yes, indeed
what about this approach instead :Measure = VAR _Lastdate = CALCULATE( MAX( YourTable[Date] ), ALL( YourTable[Date], YourTable[Month] ), YourTable[21/22 - YTD] > 0 ) RETURN CALCULATE( MAX( YourTable[Target - 21/22] ), YourTable[Date] = _LastDate )
m3tr01d
5 years agoContinued Contributor
Hello AThom
Can you try this :
Measure =
CALCULATE(
MAX( YourTable[Target - 21/22] ),
TOPN(
1,
VALUES( YourTable[Date] ),
Table[Date]
)
)AThom
5 years agoNew Member
Hi,
That doesn't work. I am trying to get a measure that gets the corresponding [Target -21/22] value based on the MAX or most recent [21/22 - YTD] value.
- m3tr01d5 years agoContinued Contributor
Ha yes, indeed
what about this approach instead :Measure = VAR _Lastdate = CALCULATE( MAX( YourTable[Date] ), ALL( YourTable[Date], YourTable[Month] ), YourTable[21/22 - YTD] > 0 ) RETURN CALCULATE( MAX( YourTable[Target - 21/22] ), YourTable[Date] = _LastDate )- AThom5 years agoNew Member
Thanks a lot, that worked