Forum Discussion

AjithTravvise's avatar
AjithTravvise
Helper II
6 years ago
Solved

Running total to date

Hello,         I have the below data where the value is running total, need help in creating a a column where it will populate the date wise    
  • v-juanli-msft's avatar
    v-juanli-msft
    6 years ago

    Hi AjithTravvise 

    If the date increases daily, you could create calculated columns below:

    earlier =
    CALCULATE (
        SUM ( 'Table'[Running Value] ),
        FILTER (
            'Table',
            'Table'[Country]
                = EARLIER ( 'Table'[Country] )
                && 'Table'[Date]
                    = EARLIER ( 'Table'[Date] ) - 1
        )
    )
    
    daily total = [Running Value]-[earlier]
    
    

    As tested, if i understand you correctly, your second visual has some wrong data due to teh calculation rule.

     

    Best Regards
    Maggie
    Community Support Team _ Maggie Li
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • AjithTravvise's avatar
    AjithTravvise
    6 years ago

    Thank you so much, it work out to perfection. 

  • Mariusz's avatar
    Mariusz
    6 years ago

    Hi AjithTravvise 

     

    This solution was created using Power Query as you have posted your question in PQ section, the script dose Include the M code in Added Column step of the script.

     

     

    Best Regards,
    Mariusz

    If this post helps, then please consider Accepting it as the solution.

    Please feel free to connect with me.
    LinkedIn