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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
AH2022
Helper II
Helper II

Power BI Dax to find max value date based on two other columns condition

Hi All,
I have a Table Shown Below.  I need a Dax Formula that will look for IDofPledge (A2), through Column Linkedgift_id (B3:B7) and returns the Max(Date) of Column DateOfInstallment (C7) in the column InstallmentEndingOn (D2).

I have tried creating a Dax column using the Dax Code below, but it doesn't seem to work.  

How do I correct the DAX in order to compare A2 with B3:B7, and to bring C7 in D2 ?

I have scoured the web looking for an answer on this topic and I tried different Filter Arguments, with no success. What am I doing Wrong? Thank You!

 

InstallmentEndingOn =

Calculate(max(Table [DateOfInstallment]),FILTER(Table, Table [linkedgift_id]=[id]))

 

 ABCD
1id  linkedgift_id  DateOfInstallment  InstallmentEndingON
2IDofPledge   2020-01-01
31 IstallmentPledgeID  IDofPledge  2016-01-01 
42 IstallmentPledgeID  IDofPledge  2017-01-01 
53 IstallmentPledgeID  IDofPledge  2018-01-01 
64 IstallmentPledgeID  IDofPledge  2019-01-01 
75 IstallmentPledgeID  IDofPledge  2020-01-01  
1 ACCEPTED SOLUTION

Thank you @yingyinr

InstallmentEndingONColumn =

CALCULATE (

MAX ( Table_Gift[date]),

FILTER ( Table_Gift, Table_Gift[linkedgift_Id] = EARLIER ( Table_Gift[Id]) )

)

 

Thank you @AUDISU

InstallmentEndingOnMeasure =

VAR IDNO = SELECTEDVALUE(Table_Gift[Id])

RETURN

MAXX(FILTER(ALL(Table_Gift),Table_Gift[linkedgift_Id] = IDNO), Table_Gift[date])

 

View solution in original post

6 REPLIES 6
AH2022
Helper II
Helper II

Hi AUDISU,

Thank you for your answer.

Here is a Print Screen.

1.Looks for [id] = 123456 within column  [linkedgift_id]
2.Calculates MaxDate within column [date] for [linkedgift_id]=123456
3.Returns MaxDate visàvis ligne [id] = 123456

Thank You.

 

AH2022_0-1659381468950.png

 

 

 

 

 

Hi @AH2022 ,

Please try following DAX formula.

InstallmentEndingOn =
VAR IDNO = SELECTEDVALUE(Table_Gift[Id])
RETURN
MAXX(FILTER(ALL(Table_Gift),Table_Gift[linkedgift_Id] = IDNO), Table_Gift[date])
 
AUDISU_0-1659407047333.png

Thank you.

Hi AUDISU,

 

It works when used as a measure. How could I transform this code to create a calculated column please?

 

I understand Ineed to convert filter context into row context.

Thank you very much.

Anonymous
Not applicable

Hi @AH2022 ,

You can create a calculated column as below to get it, please find the details in the attachment.

InstallmentEndingON = 
CALCULATE (
    MAX ( 'visàvis ligne'[date] ),
    FILTER (
        'visàvis ligne',
        'visàvis ligne'[linkedgift_id] = EARLIER ( 'visàvis ligne'[id] )
    )
)

yingyinr_0-1659518923121.png

Best Regards

Thank you @yingyinr

InstallmentEndingONColumn =

CALCULATE (

MAX ( Table_Gift[date]),

FILTER ( Table_Gift, Table_Gift[linkedgift_Id] = EARLIER ( Table_Gift[Id]) )

)

 

Thank you @AUDISU

InstallmentEndingOnMeasure =

VAR IDNO = SELECTEDVALUE(Table_Gift[Id])

RETURN

MAXX(FILTER(ALL(Table_Gift),Table_Gift[linkedgift_Id] = IDNO), Table_Gift[date])

 

AUDISU
Resolver III
Resolver III

Hi @AH2022 , 

 

Could you please show me current data table view and expected view.

 

Thank ou.

 

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 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.

Top Solution Authors
Top Kudoed Authors