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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
LD
Frequent Visitor

Max Date by Condiction

Dear,

I have the following situation:

 

Raw Data

 

Column 1             Column 2             Column 3

ID 1                         Task 1                      Due Date A

ID 1                         Task 2                      Due Date B

ID 2                         Task 1                      Due Date C

ID 3                          Task 1                     Due Date D

ID 3                          Task 2                    Due Date D

ID 3                          Task 3                    Due Date E

ID n                            ......                            ......

 

I need to select the due max due date, excluding the task 2 and considering the Column 1.

The result is the association of Max due date to ID (1,2,3, n) excluding some condiction (by Column 2).

 

Thank you!!!!

LD

 

2 ACCEPTED SOLUTIONS
LD
Frequent Visitor

Hi @camargos88 ,

 

Yes:

 

Column1Column2Due DateMeasure
ID1Task Type AJan 31, 20March 31, 20
ID1Task type BMar 31, 20March 31, 20
ID2Task Type AAug 22,20Aug 22,20
ID3Task Type AApr 18, 20Apr 18, 20
ID3Task Type CJun 20, 20 Apr 18, 20
ID4Task Type AApr 18, 20May 05,20
ID4

Task Type B

May 05,20May 05,20
ID4Task Type CJun 15, 20May 05,20

 

so the task type C, is not considered into max value

 

Thank you

LD

View solution in original post

camargos88
Community Champion
Community Champion

@LD ,

 

Try this measure:

 

Measure = CALCULATE(MAX('Table'[Due Date]); FILTER(ALLEXCEPT('Table'; 'Table'[Column1]); 'Table'[Column2] <> "Task Type C"))
 
Ricardo


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



View solution in original post

7 REPLIES 7
camargos88
Community Champion
Community Champion

Hi @LD ,

 

Try this measure:

Measure = CALCULATE(MAX('Table'[Column 3]); ALLEXCEPT('Table'; 'Table'[Column 1]))
 
directquery_sqlserverdb.png
 

If you consider it as a solution, please mark as a solution and kudos.

Ricardo

 



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



LD
Frequent Visitor

Dear @camargos88 ,

Command is quite ok..., Please, I need to exclude some row based on the Column2 (for example Task2 in Cl2)

 

Thank You

 

LD

camargos88
Community Champion
Community Champion

@LD ,

 

I didn't get what you want. 

 

Can you explain more ?

 

Ricardo



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



LD
Frequent Visitor

Yes, I'm sorry...

 

For example, I need to exclude (in ID3) the Due Date E because coming from Task3...

so all Task3 in every ID(1,2,3, n) will be not selected to determinate the max Due Date.

 

In the Example, the Due date should be "Due Date D"

 

I hope I was clear 🙂

 

Thank you!!!!

 

LD

camargos88
Community Champion
Community Champion

@LD ,

 

Can you post the expected result ?

 

Ricardo



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



LD
Frequent Visitor

Hi @camargos88 ,

 

Yes:

 

Column1Column2Due DateMeasure
ID1Task Type AJan 31, 20March 31, 20
ID1Task type BMar 31, 20March 31, 20
ID2Task Type AAug 22,20Aug 22,20
ID3Task Type AApr 18, 20Apr 18, 20
ID3Task Type CJun 20, 20 Apr 18, 20
ID4Task Type AApr 18, 20May 05,20
ID4

Task Type B

May 05,20May 05,20
ID4Task Type CJun 15, 20May 05,20

 

so the task type C, is not considered into max value

 

Thank you

LD

camargos88
Community Champion
Community Champion

@LD ,

 

Try this measure:

 

Measure = CALCULATE(MAX('Table'[Due Date]); FILTER(ALLEXCEPT('Table'; 'Table'[Column1]); 'Table'[Column2] <> "Task Type C"))
 
Ricardo


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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