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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
tomperro
Helper V
Helper V

How to get value based on 2 filters

I am trying to get the latest test number and date of the latest Non-Compliant (NC) test where there has not been another Test of the same test number completed after that NC test. I create 3 calculated columns to store this information.

Last_NC_Test_Number - last NC test number
Last NC DATE - date of the last NC test
Has Outstanding NC - flag if a follow-up test is required if the follow up has been completed with past 30 days.
 
Examples:
An employee had a NC test 123 on 01/01/2023 and has not had another test 123 since 01/01/2023.
- Last_NC_Test_Number = 123
- Last NC DATE - 01/01/2023
- Has Outstanding NC - Y
 
An employee had a NC test 123 on 01/01/2023 and has had another test 123 on 12/01/2023.
- Last_NC_Test_Number = 123
- Last NC DATE - 01/01/2023
- Has Outstanding NC - N
 
An employee had a NC test 345 and NC 123 both on 01/01/2023 and has had another test 345 on 02/01/2023.
- Last_NC_Test_Number_Contact_Column = 123
- Last NC DATE - 01/01/2023
- Has Outstanding NC - Y
 
I have the following formula but it is not retruning what I need because of MAX in calculate:
VAR LastNC_Date = CALCULATE(max(Evaluation[Date__c]),Evaluation[EmployeeId__c] &&  Evaluation[OTI_ResultForFiltering] = "NC" &&  Evaluation[TestNumber__c] <> "NC")
RETURN
CALCULATE(max(Evaluation[TestNumber__c]),  Evaluation[OTI_ResultForFiltering] = "NC" , Evaluation[Date__c] = LastNC_Date)
 
 
1 REPLY 1
lbendlin
Super User
Super User

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).

Do not include sensitive information or anything not related to the issue or question.

If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...

Please show the expected outcome based on the sample data you provided.

Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.