Forum Discussion

ADOalan1's avatar
ADOalan1
Frequent Visitor
3 years ago

Help with Dax formula

Hi,

 

I have the below DAX to givem e back first, second, third payment date but looking at the row highlighted I need to stop if let's say are only two dates so that the third payment date will be empty.

 

I need to add the additional code to this dax.

 

 

Any help will be much apprecaited

 

Thanks

 

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi ADOalan1 

    You can try the following code

    Date 3 =
    VAR _top3 =
        TOPN ( 3, nfp_donation, nfp_donation[Income Date], ASC )
    VAR _count =
        COUNTROWS ( SUMMARIZE ( _top3, nfp_donation[Income Date] ) )
    RETURN
        IF (
            _count > 2,
            IF (
                HASONEVALUE ( nfp_donation[Form ID] ),
                MAXX ( _top3, nfp_donation[Income Date] )
            )
        )
    

    Best Regards!

    Yolo Zhu

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.