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

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

Reply
Anonymous
Not applicable

Create custom column using max and filter

Hi,

 

I have a table like below:

Id     Name   Type Date

100   Apple    fruit   12/01/2020

100   Apple     sweet 15/01/2020

 

I want to create the report where Type =fruit and one date column new_date=max(Date) where Type=sweet

 

Id Name Type New_Date

100 Apple fruit  15/01/2020

 

I tried many options but failed to to get desird result.

 

Thanks,

Milan

 

  

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

Create new table,

Table 2 = SUMMARIZE('Table','Table'[ID],'Table'[Name],'Table'[Type],"New_date",CALCULATE(MAX('Table'[Date]),ALLEXCEPT('Table','Table'[ID]),'Table'[Type]="Sweet"))
 
Or if you want to do by previous method then
create measure as below
Measure = CALCULATE(MAX('Table'[Date]),ALLEXCEPT('Table','Table'[ID]),'Table'[Type]="Sweet")
 
and filtet out type.
 
www.linkedin.com/in/pravin-p-wattamwar

If I resolve your problem Mark it as a solution and give kudos.
 

View solution in original post

Anonymous
Not applicable

New Column = CALCULATE(MAX('Table'[Date]),ALLEXCEPT('Table','Table'[ID]),'Table'[Type]="Sweet")
 
 and filter out type.
 
Thanks,
Pravin
 
If I resolve your problem Mark it as a solution and give kudos.

View solution in original post

9 REPLIES 9
Anonymous
Not applicable

Hi,

Actually i gave you incomplete data. My apology.

Data looks like:

ID Name Type Date

100 apple  fruit 01/01/2020

100 apple  sweet 02/02/2020

200  banana fruit 03/03/2020

200 banana sweet 04/04/2020

 

Expected output

ID Name new_Date

100 apple 02/02/2020

200 banana 04/04/2020

 

filter: Type=fruit

New_date logic= Max(date) where type=sweet

 

I tried:

CALCULATE(MAX(Table(date),FILTER(Table,table[type]="sweet"))

but it gave me

ID Name new_Date

100 apple 04/04/2020

200 banana 04/04/2020

 

I think I need to put GROUPBY but exactly how and where its where i am struggling.

 

Thanks,

Milan

 

 

You are taking the max of the date on fruit, then why type filter.

Min of type and max of date will work as long as view/group by is fruit.

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Create new table,

Table 2 = SUMMARIZE('Table','Table'[ID],'Table'[Name],'Table'[Type],"New_date",CALCULATE(MAX('Table'[Date]),ALLEXCEPT('Table','Table'[ID]),'Table'[Type]="Sweet"))
 
Or if you want to do by previous method then
create measure as below
Measure = CALCULATE(MAX('Table'[Date]),ALLEXCEPT('Table','Table'[ID]),'Table'[Type]="Sweet")
 
and filtet out type.
 
www.linkedin.com/in/pravin-p-wattamwar

If I resolve your problem Mark it as a solution and give kudos.
 
Anonymous
Not applicable

Thanku 2nd option worked for me.

 

Thanks,

Milan

Anonymous
Not applicable

New table=Summerize(filter(table,table[type]="Sweet"),table[id],Table[Name],Table[Type],"New_Date",MAx(Table[Date]))

 

Thanks,

Pravin

www.linkedin.com/in/pravin-p-wattamwar

If I resolve your problem Mark it as a solution and give kudos.

Anonymous
Not applicable

Hi,

 

Actually I don't want to create new table. Can it be done using create new column on the same table.

 

Appriciate your help.

 

Thanks,

Milan

Anonymous
Not applicable

New Column = CALCULATE(MAX('Table'[Date]),ALLEXCEPT('Table','Table'[ID]),'Table'[Type]="Sweet")
 
 and filter out type.
 
Thanks,
Pravin
 
If I resolve your problem Mark it as a solution and give kudos.
amitchandak
Super User
Super User

Take Min of Type and Max of Fruit in Visual or create a new table like

new table = summarize(table,table[Id],table[Name],"_Type",Min(Type),"_date",Max(Date))

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution.
In case it does not help, please provide additional information and mark me with @

Thanks. My Recent Blogs -Decoding Direct Query - Time Intelligence, Winner Coloring on MAP, HR Analytics, Power BI Working with Non-Standard TimeAnd Comparing Data Across Date Ranges
Proud to be a Datanaut Connect on Linkedin

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Create one measure

Measure= Calculate(Max(table[Date],all(table)

 

Then drag id,name,type,measure in table visual and go to visual level filter and set type is fruit.

 

Thanks & regards,
Pravin Wattamwar
www.linkedin.com/in/pravin-p-wattamwar

If I resolve your problem Mark it as a solution and give kudos.

Helpful resources

Announcements
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 Kudoed Authors