Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Sum Values in a column row by row

Hello, 

 

I would appreciate the help of the community very much. 

I am searching for a solution to summarize the values of column Count, but the result in SUM should summarize only the values from the current row backwards. For illustration, please note the line with index number 6.

 

 

Thank you very much for taking time and a good day. 

 

  • Anonymous's avatar
    Anonymous
    4 years ago

    Thank you for your quick feedback and your help.

    I could implement your solution, but I have got this result. 

     

     

    I have added the code like this:

     

    Did I something wrong?

    Thank you for your patience. 

4 Replies

  • SpartaBI's avatar
    SpartaBI
    Icon for Community Champion rankCommunity Champion

    Anonymous 

    SUM RT =
    VAR _curr_index =
        SELECTEDVALUE ( Table[Index] )
    RETURN
    	CALCULATE(
    		SUM(Table[Count],
    		REMOVEFILTERS(Table),
    		Table[Index] < = _curr_index
    	)
    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you for your quick feedback and your help.

      I could implement your solution, but I have got this result. 

       

       

      I have added the code like this:

       

      Did I something wrong?

      Thank you for your patience. 

    • Anonymous's avatar
      Anonymous
      Not applicable

      Now it works. I have checked the Variable _curr_index and it was always empty. For this reason I have removed  the function SELECTEDVALUE. 

       

      This are the results:

       

      Here is the code:

       

      Thank you a lot for your help.