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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.