Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

running total with filter date

Can any one help with dax for filter date and car number should get running total of the person from stating 

example table

NameCar AmountType of debitDateNetDebitCreditBalance
XYZ XX car1000Amount debit21-03-2024 00:051000100001,000.00
XYZ XX car1000Amount debit21-03-2024 00:051000100002,000.00
XYZ XX car160Amount debit21-03-2024 00:0516016002,160.00
XYZ XX car172.36Amount debit21-03-2024 00:05172.36172.3602,332.36
XYZ XX car125Amount debit21-03-2024 00:0512512502,457.36
XYZ XX car12.76Amount debit21-03-2024 00:0512.7612.7602,470.12
XYZ XX car1608.74OnlinePayment21-03-2024 00:05-1608.701608.74861.38
  • Hi, Anonymous 

     

    try below code for measure

    running total = CALCULATE(SUM('Table (4)'[Balance]),
                                   FILTER(
                                    ALLSELECTED('Table (4)'),
                                    'Table (4)'[Date]<=MAX('Table (4)'[Date])))

     

     

    All date are same that the reason total balance are same in all row

     


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

3 Replies

  • Dangar332's avatar
    Dangar332
    Icon for Resident Rockstar rankResident Rockstar

    Hi, Anonymous 

    try below code for new column

    Column = 
    SUMX(
        FILTER(
            ALL('Table (2)'),
             'Table (2)'[Name]=EARLIER('Table (2)'[Name]) && 
             'Table (2)'[Car ]=EARLIER('Table (2)'[Car ]) && 
             'Table (2)'[Date]<=EARLIER('Table (2)'[Date])
        ),
        'Table (2)'[Balance]
    )

     

    just adjust table name and column name

  • Hi, Anonymous 

     

    try below code for measure

    running total = CALCULATE(SUM('Table (4)'[Balance]),
                                   FILTER(
                                    ALLSELECTED('Table (4)'),
                                    'Table (4)'[Date]<=MAX('Table (4)'[Date])))

     

     

    All date are same that the reason total balance are same in all row

     


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

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Thank you for reply,

       actually there is not balance colume i required a balance colume as a running total so that if it filter a car number automatically it should the balnce from start date to end date as shown in the example but your query will show the same for all the days