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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.