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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
JoeKulasa
Regular Visitor

Running Total based on Separate Calculation

Hello,

 

I am looking to create a column that creates a running total based on another calculated column.  I want the running total to capture the sum of the column "Difference", and reset everytime there's a new shift introduced.  Screenshot below for how I've tried to use the variable.  I've also included how the "Difference" column is calculated.

 

JoeKulasa_0-1618318407141.png

 

JoeKulasa_1-1618318453056.png

 

 

1 ACCEPTED SOLUTION
v-luwang-msft
Community Support
Community Support

Hi  @JoeKulasa 

You could use the following measure:

Difference2= if(HASONEVALUE('CPM 21'[shift]),[difference],sumx(ALL('CPM 21'),'CPM 21'[difference]))

Due to without your pbix file ,so I use my data as a sample,the below,[onemon] is a mesaure,so the number total is incorrect:

v-luwang-msft_0-1618470658175.png

 then use the following measure:

Jan = IF(HASONEVALUE('Table'[MATERIAL]),[onemon], SUMX(ALL('Table'),'Table'[onemon]))

Final get what I want!

v-luwang-msft_1-1618470720570.png

 

Wish it is helpful for you!

 

Best Regards

Lucien

View solution in original post

3 REPLIES 3
v-luwang-msft
Community Support
Community Support

Hi  @JoeKulasa 

You could use the following measure:

Difference2= if(HASONEVALUE('CPM 21'[shift]),[difference],sumx(ALL('CPM 21'),'CPM 21'[difference]))

Due to without your pbix file ,so I use my data as a sample,the below,[onemon] is a mesaure,so the number total is incorrect:

v-luwang-msft_0-1618470658175.png

 then use the following measure:

Jan = IF(HASONEVALUE('Table'[MATERIAL]),[onemon], SUMX(ALL('Table'),'Table'[onemon]))

Final get what I want!

v-luwang-msft_1-1618470720570.png

 

Wish it is helpful for you!

 

Best Regards

Lucien

amitchandak
Super User
Super User

@JoeKulasa , Try a measure like

calculate(sum('CPM 21'[difference]) , filter(allselected('CPM 21'), 'CPM 21'[Day] <= max('CPM 21'[Day])))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak Thanks for the suggestion.  No luck yet - I used your suggestion as a column and a measure and here are the results. Note the "Shift" reset does appear to work, but it looks like it's aggregating on the shift as opposed to created a running total.

 

JoeKulasa_0-1618322796677.png

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors