Forum Discussion

JohannSteyn's avatar
JohannSteyn
Frequent Visitor
4 years ago
Solved

Filter relative to current row

Hi all,
I need some help please. I think have this basic issue embedded in a more complex forumla.

 

I have the following columns: Date 1, Date 2, Amount.
I want to add a column with the sum of the amount when any Date 2 is larger (or equal) to the specific row's Date 1.

This is what I want (excel representation):

 

Please help with suggestions that I can use in DAX to add a column with the above result.

 

Thanks in advance

 

  • amitchandak's avatar
    amitchandak
    4 years ago

    JohannSteyn , Sorry, I think I reverted the logic

     

    new column =
    var _date = [Date1]
    return
    sumx(filter(Table, Table[Date2] >=_Date),[Amount])

4 Replies

  • JohannSteyn , Try a new column like

     

    new column =
    var _date = [Date2]
    return
    sumx(filter(Table, Table[Date1] <=_Date),[Amount])

    • JohannSteyn's avatar
      JohannSteyn
      Frequent Visitor

      amitchandak  Thanks for the suggestion. Unfortuntely that does not work (see below). Any other ideas?

       

      • amitchandak's avatar
        amitchandak
        Icon for Super User rankSuper User

        JohannSteyn , Sorry, I think I reverted the logic

         

        new column =
        var _date = [Date1]
        return
        sumx(filter(Table, Table[Date2] >=_Date),[Amount])