Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Anonymous
Not applicable

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
Anonymous
Not applicable

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
Anonymous
Not applicable

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])))
jdbuchanan71
Super User
Super User

Hello @Anonymous 

Give this a try:

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

runningtotal.jpg

Anonymous
Not applicable

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

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

Check out the September 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

Find out what's new and trending in the Fabric Community.

Top Kudoed Authors