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

See when key Fabric features will launch and what’s already live, all in one place and always up to date. Explore the new Fabric roadmap

Reply
Anonymous
Not applicable

Max of a column based on two other Columns Extracted into a New Column

 

 

I want to find the max of the "Sold" column based on the max "ReadingDate" for each product category extracted to a new column called "MaxSold" . Please, I would like to use DAX for this. For example, Beans would extracted as 9 as the max based on the date time field. Thanks so much.

 

 

 

 

ReadingDatePrroductSold
7/1/2020 : 7:37:44 PMBeans1
7/1/2020 : 7:45:29 AMBeans0
7/3/2020 : 7:37:44 PMRice0
7/1/2020 : 5:37:44 AMFruit3
7/16/2020 : 7:37:44 AMRice0
7/5/2020 : 10:00:44 AMYam4
7/16/2020 : 04:37:44 PMYam5
7/8/2020 : 11:37:14 PMFruit3
7/1/2020 : 5:37:13 AMYam1
7/15/2020 : 7:37:44 PMFruit0
7/4/2020 : 2:02:12 PMBeans1
7/5/2020 : 7:37:44 AMBeans0
7/5/2020 : 7:37:44 PMRice2
7/10/2020 : 5:27:09 PMBeans9
7/16/2020 : 7:37:44 PMRice0
7/16/2020 : 6:20:11AMRice3
7/17/2020 : 7:37:44 PMRice4
7/16/2020 : 12:37:44 PMFruit8
7/16/2020 : 9:37:40 AMFruit9
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Try

lastnonblankvalue(Table[Date],max(Table([Sold])))
or
lastnonblankvalue(Table[Date],sum(Table([Sold])))

 

Refer this blog : https://www.linkedin.com/pulse/five-recent-power-bi-functions-you-should-use-more-often-amit-chandak

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Anonymous , Try

lastnonblankvalue(Table[Date],max(Table([Sold])))
or
lastnonblankvalue(Table[Date],sum(Table([Sold])))

 

Refer this blog : https://www.linkedin.com/pulse/five-recent-power-bi-functions-you-should-use-more-often-amit-chandak

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

THANK YOU SO MUCH, it worked like a charm 😁

Greg_Deckler
Super User
Super User

@Anonymous - Seems like you want Lookup Min/Max - https://community.powerbi.com/t5/Quick-Measures-Gallery/Lookup-Min-Max/m-p/985814#M434



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
May PBI 25 Carousel

Power BI Monthly Update - May 2025

Check out the May 2025 Power BI update to learn about new features.

May 2025 Monthly Update

Fabric Community Update - May 2025

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