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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
MarkD1733
New Member

Running total--exclude one column value in stacked column but display full year trend

I have a running total of spend and monthly spend showing in a combination stacked column and line chart.  The stacked bars are monthly spend, but a monthly budget value is mixed in as well.   I don't want to display that budget value in the column so I slice it out.  But when I don't have spend values in a month, the cumulative budget total doesn't display...it omits the months with no spend (i.e., Nov and Dec below).  So, I am using a calendar table and am "showing items with no data."  But as you can see, my budget trend ends at October because I have no spend in November and December and have excluded the budget from the monthly totals.  Is it possible to make that trend line continue through Nov and Dec?

 

1361b4c1-93c3-488c-8295-e8c63b2d3763.jpg

 
Here is my DAX code for the budget cumulative trend.  It contains some filtering (for dynamic filtering):

MarkD1733_0-1669908692598.png

 

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

Hi @MarkD1733 ,

 

This is my test table ( no spend in November and December)

vyadongfmsft_0-1669964759430.png

 

Create a calendar table:

 

CalendarTable = ADDCOLUMNS(CALENDAR(DATE(2022,1,1),DATE(2022,12,31)),"Month",FORMAT([Date],"mmm"),"MonthNumber",MONTH([Date]))

 

vyadongfmsft_1-1669964887057.png

 

Create following measures:

 

Cumulative_budget = CALCULATE(SUM('Table'[Amount USD]),'Table'[Category] = "Month Budget",FILTER(ALL('CalendarTable'),'CalendarTable'[Date] <= MAX('CalendarTable'[Date])))

Cumulative_spend = CALCULATE(SUM('Table'[Amount USD]),'Table'[Category] = "Month Spend",FILTER(ALL('CalendarTable'),'CalendarTable'[Date] <= MAX('CalendarTable'[Date])))

Sum_amount USD = CALCULATE(SUM('Table'[Amount USD]),FILTER(ALL('CalendarTable'),'CalendarTable'[Month] = SELECTEDVALUE('CalendarTable'[Month])))

 

 

I think this is the result you want:

vyadongfmsft_2-1669965206603.png

 

 

Best regards,

Yadong Fang

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

View solution in original post

1 REPLY 1
v-yadongf-msft
Community Support
Community Support

Hi @MarkD1733 ,

 

This is my test table ( no spend in November and December)

vyadongfmsft_0-1669964759430.png

 

Create a calendar table:

 

CalendarTable = ADDCOLUMNS(CALENDAR(DATE(2022,1,1),DATE(2022,12,31)),"Month",FORMAT([Date],"mmm"),"MonthNumber",MONTH([Date]))

 

vyadongfmsft_1-1669964887057.png

 

Create following measures:

 

Cumulative_budget = CALCULATE(SUM('Table'[Amount USD]),'Table'[Category] = "Month Budget",FILTER(ALL('CalendarTable'),'CalendarTable'[Date] <= MAX('CalendarTable'[Date])))

Cumulative_spend = CALCULATE(SUM('Table'[Amount USD]),'Table'[Category] = "Month Spend",FILTER(ALL('CalendarTable'),'CalendarTable'[Date] <= MAX('CalendarTable'[Date])))

Sum_amount USD = CALCULATE(SUM('Table'[Amount USD]),FILTER(ALL('CalendarTable'),'CalendarTable'[Month] = SELECTEDVALUE('CalendarTable'[Month])))

 

 

I think this is the result you want:

vyadongfmsft_2-1669965206603.png

 

 

Best regards,

Yadong Fang

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

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors