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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

hello everyone, I'm trying to calculate running total for each month

Here I have created a measure  ie 

 

Here I need to do sum of each month for example.. for feb 2+1 +3+1+4+2=13 and for march 4+2+1+5+3+1+6+4+1= 27

 

Please help me with a dax function for the below data 

 

measure 1        measure 2       measure 3       month      

1                            1                          2                 jan

2                            3                           4               feb

4                            5                          6                march

1                           3                           4                April

1                            4                         5                 may

2                            8                          9               June

2                            8                         10              JUl

 

 

 

 

 

 

 

3 REPLIES 3
Anonymous
Not applicable

Capture.JPG

Here in the above image I have headcount for column 2 is 6516 and head counts for id is 509 . And I have created country column to make relationship between column 2 and id column. when I'm giving month filter in visual filter I'm getting right count for column 2 but not for id I need to get 509 but I'm getting 504 please help me out 

 

Here in the above image 

v-xicai
Community Support
Community Support

Hi @Anonymous 

 

According to your description, I create sample data to test the scenario. You can create column Month_Num to get the month number, and create measure Cumulative_Total to calculate cumulative total.

 

Month_Num = SWITCH(Table1[Month],"Jan",1,"Feb",2,"Mar",3,"Apr",4,"May",5,"Jun",6,"Jul",7,"Aug",8,"Sep",9,"Oct",10,"Nov",11,"Dec",12)

 

Cumulative_Total =

VAR _table=SUMMARIZE(Table1,Table1[Month_Num],"measure1",Table1[Measure1],"measure2",Table1[Measure2],"measure3",Table1[Measure3])

RETURN

SUMX(FILTER(_table,[Month_Num]<=EARLIER([Month_Num])),[measure1])+SUMX(FILTER(_table,[Month_Num]<=EARLIER([Month_Num])),[measure2])+SUMX(FILTER(_table,[Month_Num]<=EARLIER([Month_Num])),[measure3])

 

8.png 

 

 

 

 

 

 

Here is my test pbix: https://qiuyunus-my.sharepoint.com/:u:/g/personal/pbipro_qiuyunus_onmicrosoft_com/EXm0jsV1b-xLswi55UudKfoBjothc41f3ZRcX0ry6SBPGg?e=bhkQZW

 

Best Regards,

Amy

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hello @v-xicai 

 

I need to calculate som of 3 consecutive months i.e jan=jan, feb = jan+feb, march= Jan+feb+march, april= Feb+march+april, may= march+april+May, June= April+May+June................Dec= oct+nov+Dec..

 

Can you please help me out with the query. 

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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