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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
NickOIT
New Member

DAX Calculate - Filter max date on several columns

Hi,

 

I'm struggling to figure out how to filter out duplicate rows based on the latest run date for each program and computer.

I think I'm almost there but can't quite figure it out.

 

Here's an example::

ClientIDProgramNameLastRun
1Program12017-12-20
1Program12017-11-01
1Program22017-12-21
2Program12016-01-01

 

What I'm trying for:

ClientIDProgramNameLastRun
1Program12017-12-20
1Program22017-12-21
2Program12016-01-01

 

I found another thread with a similar issue request but they only had a single column that they had to match with the date column. The solution I found there works, but it only filters the latest date per client and not per client & program.

 

 

IsLatestChangedDateByID = Sheet1[LastRun] = 
	CALCULATE(
		MAX(Sheet1[LastRun]); 
		FILTER(ALL(Sheet1); Sheet1[ClientID]=EARLIER(Sheet1[ClientID]))
	)

 

Anybody got any ideas on how I can proceed?

Thanks for any help.

 

1 ACCEPTED SOLUTION
v-yuezhe-msft
Employee
Employee

@NickOIT,

Create your column using the dax below.

IsLatestChangedDateByID = 
	CALCULATE(
		MAX(Sheet1[LastRun]);
		FILTER(ALL(Sheet1); Sheet1[ClientID]=EARLIER(Sheet1[ClientID])&&Sheet1[ProgramName]=EARLIER(Sheet1[ProgramName]))
	)


Alternatively, right click your table and select "New Measure", apply DAX below.

Measure = MAX(Sheet1[LastRun])

1.JPG

Regards,
Lydia

 

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-yuezhe-msft
Employee
Employee

@NickOIT,

Create your column using the dax below.

IsLatestChangedDateByID = 
	CALCULATE(
		MAX(Sheet1[LastRun]);
		FILTER(ALL(Sheet1); Sheet1[ClientID]=EARLIER(Sheet1[ClientID])&&Sheet1[ProgramName]=EARLIER(Sheet1[ProgramName]))
	)


Alternatively, right click your table and select "New Measure", apply DAX below.

Measure = MAX(Sheet1[LastRun])

1.JPG

Regards,
Lydia

 

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you so much! 
I was so close, must've written something wrong when I tried it yesteday.

 

I'll try your second suggestion as well after the holidays. 🙂

 

Merry Christmas!

 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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