cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
oroberto Frequent Visitor
Frequent Visitor

increment sum value group by month and item type

hi,

 

I'm trying to incremental summing my table's column value by it's datetime and group.

so far, I have created this dax code for it:

CALCULATE(SUM('my_table'[value]),FILTER('my_table'[type]='my_table'[type]&&'my_table'[datetime]<=EARLIER('my_table'[datetime])))

this code are doing the incrimental summing, but it won't sum my value data for each group that i have.

community.PNG

 

do anyone have idea where did my code went wrong?

or maybe another way to get the result that I want.

1 ACCEPTED SOLUTION

Accepted Solutions
oroberto Frequent Visitor
Frequent Visitor

Re: increment sum value group by month and item type

hi, 

 

fixed my code and got the result that I want.

 

this is my final code, in case there are someon who has the same problem 

column = CALCULATE(SUM('my_table'[value]),FILTER('my_table','my_table'[datetime]<=EARLIER('my_table'[datetime])&&'my_table'[type]=EARLIER(my_table[type])))

View solution in original post

3 REPLIES 3
Super User
Super User

Re: increment sum value group by month and item type

Hello @oroberto 

Give this a try:

Running Total = 
VAR MaxDate = MAX ( MyTable[DateTime] )
RETURN 
CALCULATE (
    SUM ( MyTable[Value] ),
    ALL ( MyTable[DateTime] ),
    MyTable[DateTime] <= MaxDate
)

runningtotal.jpg

oroberto Frequent Visitor
Frequent Visitor

Re: increment sum value group by month and item type

hi @jdbuchanan71 ,

 

thank you for the code.

tried it on my side, but sadly it's not incrementally sum my value but only showing the exact same data as my value collumn

 

typevaluedatetimeexpected_resultresult_from_my_coderesult_from_your_code
CR52019/04/01 0:005155
CR52019/05/01 0:0010305
CR52019/06/01 0:0015455
KR62019/04/01 0:006156
KR62019/05/01 0:0012306
KR62019/06/01 0:0018456
YR42019/04/01 0:004154
YR42019/05/01 0:008304
YR42019/06/01 0:0012454
oroberto Frequent Visitor
Frequent Visitor

Re: increment sum value group by month and item type

hi, 

 

fixed my code and got the result that I want.

 

this is my final code, in case there are someon who has the same problem 

column = CALCULATE(SUM('my_table'[value]),FILTER('my_table','my_table'[datetime]<=EARLIER('my_table'[datetime])&&'my_table'[type]=EARLIER(my_table[type])))

View solution in original post

Helpful resources

Announcements
October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

Analytics in Azure virtual event

Analytics in Azure virtual event

Experience a limitless analytics service built to ingest, prep, manage, and serve data for immediate use in Power BI.

Users Online
Currently online: 139 members 1,682 guests
Please welcome our newest community members: