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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
adavid999
Helper V
Helper V

Dax measure to select date for latest/max value

Hello, 

 

how do I write a measure to select the date alongside the latest/max value?

 

Based on below, I would like my measure to display as "07/02/2022" as 1.68 is the latest/max value.

 

dateindexvalue
31/01/202200
07/02/202211.68
14/02/20222null
21/02/20223null
28/02/20224null
07/03/20225null
14/03/20226null
21/03/20227null
28/03/20228null
04/04/20229null
11/04/202210null
18/04/202211null
25/04/202212null
02/05/202213null

Thanks

A

2 ACCEPTED SOLUTIONS
freginier
Solution Specialist
Solution Specialist

Create a measure or column with this

var MaxValue = MAX( 'Table'[Column2] )
return 
LOOKUPVALUE('Table'[Column1],'Table'[Column2],MaxValue)

View solution in original post

adavid999
Helper V
Helper V

Thanks @freginier though this doesn't work for me on table below. Do you know why?

var MaxValue = MAX( 'Table'[Column2] )
return 
LOOKUPVALUE('Table'[Column1],'Table'[Column2],MaxValue)

 

 

Column1Column2
31/01/20220
07/02/20221.68
14/02/2022null
21/02/2022null
28/02/2022null
07/03/2022null
14/03/2022null
21/03/2022null
28/03/2022null
04/04/2022null
11/04/2022null
18/04/2022null
25/04/2022null
02/05/2022null

View solution in original post

7 REPLIES 7
adavid999
Helper V
Helper V

Thanks @freginier though this doesn't work for me on table below. Do you know why?

var MaxValue = MAX( 'Table'[Column2] )
return 
LOOKUPVALUE('Table'[Column1],'Table'[Column2],MaxValue)

 

 

Column1Column2
31/01/20220
07/02/20221.68
14/02/2022null
21/02/2022null
28/02/2022null
07/03/2022null
14/03/2022null
21/03/2022null
28/03/2022null
04/04/2022null
11/04/2022null
18/04/2022null
25/04/2022null
02/05/2022null

Can you send me a power bi sample with this 2 columns ? 

sorry, this did work. I neglected to name the measure when I copied your code

my measure = var MaxValue = MAX( 'Table'[Column2] )
return 
LOOKUPVALUE('Table'[Column1],'Table'[Column2],MaxValue)

 

Good. Enjoy 🙂

Don't forget to add kudo and accept the solution 😉 

Hi @freginier I'm not authorised to upload pbix files but it's basically something like this:

adavid999_0-1643624498424.png

 

See this Pbi file 

https://we.tl/t-CODQTtLNVK 

freginier
Solution Specialist
Solution Specialist

Create a measure or column with this

var MaxValue = MAX( 'Table'[Column2] )
return 
LOOKUPVALUE('Table'[Column1],'Table'[Column2],MaxValue)

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.