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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
danielgibbs
Frequent Visitor

Trying to use MAX and IF functions (like in Excel) based on another column

Hi Everyone,

 

Trying to use MAX and IF functions(Based in excel) within a table to find a Date value (MAX_DATE) in a custom column. I want Max date based on AssetID to populate in the MaxDate column.

 

Here's an example of the dataset.

 

ASSET_IDEND_DATEMAX_DATE
1006/30/20179/1/2019
1006/30/20179/1/2019
1009/1/20199/1/2019
1006/30/20179/1/2019
1016/30/201711/1/2019
10111/1/201911/1/2019
1016/30/201811/1/2019
1026/30/20173/1/2020
1023/1/20203/1/2020
1026/30/20173/1/2020
1029/1/20193/1/2020
10312/31/201912/31/2021
10312/31/202112/31/2021

 

Thanks in advance for your help!!!

2 ACCEPTED SOLUTIONS
Greg_Deckler
Community Champion
Community Champion

If you can use a Measure instead, this should be simply:

 

MAX_DATE = MAX(Assets[END_DATE])

Then just put your ASSET_ID and this measure into a table visualization.

 

Another way to go would be to create an ASSET_IDS table with unique asset ids and a custom column in that table like so:

 

MAX_DATE = MAXX(RELATEDTABLE(Assets),[END_DATE])

 

 



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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

Anonymous
Not applicable

Hi @danielgibbs,

In your scenario, please firstly open Query Editor and add an index column to your current table as shown in the following screenshot.
1.png

Secondly, create a new column using the formula below.

Max Date = CALCULATE(MAX(Table1[END_DATE]),FILTER(Table1,Table1[ASSET_ID]=EARLIEST(Table1[ASSET_ID])))

Thirdly, create a table visual using all the fields. For more details, you can check the example in the attached PBIX file.
2.PNG

Thanks,
Lydia Zhang

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @danielgibbs,

In your scenario, please firstly open Query Editor and add an index column to your current table as shown in the following screenshot.
1.png

Secondly, create a new column using the formula below.

Max Date = CALCULATE(MAX(Table1[END_DATE]),FILTER(Table1,Table1[ASSET_ID]=EARLIEST(Table1[ASSET_ID])))

Thirdly, create a table visual using all the fields. For more details, you can check the example in the attached PBIX file.
2.PNG

Thanks,
Lydia Zhang

thanks for your help on this!!

Greg_Deckler
Community Champion
Community Champion

If you can use a Measure instead, this should be simply:

 

MAX_DATE = MAX(Assets[END_DATE])

Then just put your ASSET_ID and this measure into a table visualization.

 

Another way to go would be to create an ASSET_IDS table with unique asset ids and a custom column in that table like so:

 

MAX_DATE = MAXX(RELATEDTABLE(Assets),[END_DATE])

 

 



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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

thanks for your help on this one!!

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors