cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
Anonymous
Not applicable

MAX Date for each repetitive id

Hey,

My table follows this structure:

idDateStatus
1 14/02/2021   ERROR
1 19/06/2020 OK
2 30/05/2021 OK
3 16/01/2021 OK
3 22/04/2021 ERROR
4 29/12/2020 OK

As you can see, each id can have more than one row, but always with different dates.
I want to create a calculated table only with the rows where the year is equal to the current year and get only the MAX DATE of each id. So the calculated table on the table above should be:

idDateStatus
1 14/02/2021 ERROR
2 30/05/2021 OK
3 22/04/2021 OK

 

How can I do this?

1 ACCEPTED SOLUTION
Fowmy
Super User
Super User

@Anonymous 

Create a table as follows:

FILTER(
	Table1,
	year(Table1[Date]) = year(TODAY()) &&
	CALCULATE(	
		max(Table1[Date]),
		ALLEXCEPT(table1,Table1[id])
	) = Table1[Date]
	
)

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

1 REPLY 1
Fowmy
Super User
Super User

@Anonymous 

Create a table as follows:

FILTER(
	Table1,
	year(Table1[Date]) = year(TODAY()) &&
	CALCULATE(	
		max(Table1[Date]),
		ALLEXCEPT(table1,Table1[id])
	) = Table1[Date]
	
)

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors