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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
KasperBI
Frequent Visitor

Checking for max value in summarized table DAX help

Hi everyone. I have data that looks like this:

 

TestCaseIDConfigurationRunDate
1108-04-2021 11:10:10
1108-04-2021 12:10:10
1208-04-2021 13:10:10
2108-04-2021 08:08:08
2208-04-2021 09:09:09
2208-04-2021 10:10:10
3108-04-2021 09:09:09
3108-04-2021 11:11:11
3208-04-2021 10:10:10

 

I have a table in my PBI report where the user can select test cases, and whatever configurations they want through slicers. I want the table to only display the latest test run within the configuration. 

 

So I ideally would create a calculated column that checks whether the current test/configuration is the last one for the configuration. The data output should look something like this:

 

TestCaseIDConfigurationRunDate FilterCheck
1108-04-2021 11:10:10Remove
1108-04-2021 12:10:10Keep
1208-04-2021 13:10:10Keep
2108-04-2021 08:08:08Keep
2208-04-2021 09:09:09Remove
2208-04-2021 10:10:10Keep
3108-04-2021 09:09:09Remove
3108-04-2021 11:11:11Keep
3208-04-2021 10:10:10Keep

 

This is the code I have so far:

LatestTest =
VAR MaxDateForCombo =
//returns a table with a combined column from test ID and Config name and the maximum (latest) test result.

SUMMARIZE (
ADDCOLUMNS (
'Test Results',
"TestIDConfig", CONCATENATE ( 'Test Results'[TestcaseId], 'Test Results'[Configuration] ),
"RunDate2", MAX ( 'Test Results'[RunDate] )
),
[TestIDConfig],
"MaxRunDate", MAX ( 'Test Results'[RunDate] )
)

//the current row context date
Var Currentdate = 'Test Results'[RunDate]

// If the current date is smaller than the maximum date for the selected combinations of runID and config then filter it out.
Var FilterCheck = IF(Currentdate<


,"Filter out","Keep in")
RETURN
FilterCheck


I am having problems with the filtercheck part. I thought about using lookupvalue on the summarized table to see if rundate2 was bigger than rundate, but I can't figure it out. can someone help me out to get to my desired result? 🙂
1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi, @KasperBI 

 

Please correct me if I wrongly understood your question.

 

Please check the below Calculated Column and the link down below, which is the sample pbix file.

 

Latest Test Column =
VAR lastnonblankcheck =
CALCULATE (
LASTNONBLANK ( 'Test Results'[RunDate], MAX ( 'Test Results'[Configuration] ) ),
ALLEXCEPT (
'Test Results',
'Test Results'[TestCaseID],
'Test Results'[Configuration]
)
)
RETURN
IF ( 'Test Results'[RunDate] = lastnonblankcheck, "Keep", "Remove" )

 

https://www.dropbox.com/s/xxpqyuj3xk6l2or/KasperBI.pbix?dl=0 

 

 

Hi, My name is Jihwan Kim.

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

View solution in original post

2 REPLIES 2
Jihwan_Kim
Super User
Super User

Hi, @KasperBI 

 

Please correct me if I wrongly understood your question.

 

Please check the below Calculated Column and the link down below, which is the sample pbix file.

 

Latest Test Column =
VAR lastnonblankcheck =
CALCULATE (
LASTNONBLANK ( 'Test Results'[RunDate], MAX ( 'Test Results'[Configuration] ) ),
ALLEXCEPT (
'Test Results',
'Test Results'[TestCaseID],
'Test Results'[Configuration]
)
)
RETURN
IF ( 'Test Results'[RunDate] = lastnonblankcheck, "Keep", "Remove" )

 

https://www.dropbox.com/s/xxpqyuj3xk6l2or/KasperBI.pbix?dl=0 

 

 

Hi, My name is Jihwan Kim.

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Thank you so much, that does seem to work. 

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.