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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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