Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
AThom
New 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?Capture.PNG

 

1 ACCEPTED SOLUTION
m3tr01d
Continued Contributor
Continued 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
)

 

View solution in original post

4 REPLIES 4
m3tr01d
Continued Contributor
Continued Contributor

Hello @AThom 

Can you try this :

Measure = 
CALCULATE(
	MAX( YourTable[Target - 21/22] ),
	TOPN(
		1, 
		VALUES( YourTable[Date] ),
		Table[Date]
	)
)

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. 

m3tr01d
Continued Contributor
Continued 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
)

 

Thanks a lot, that worked

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.