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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Cumulative sum by month with missing months results in gaps in clustered column chart

I am tring to have a chart the shows cumulative sum within a financial year including any missing months. The problem is I am extracting data from sql server 2008 ( I have tried to fix in sql but found it to complicated) and many months have no data as can be seen below in a matrix.

 

(so ideally oct-2016 should be 6,450.00)

 

2.png

 

I am trying to make a culmative clustered column chart like this.

 

3.png

but my data has missing months, so in power bi it ends up looking like this with missing columns:

1.png

 

The example I have shown is just one project, I have thousands of projects spanning over multiple financial years. 

 

data looks like this:

4.png

Any help would be much appreciated.

 

If needed I can upload my pbix, im just not sure how to do it?

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous

 

So I've created a new example with equivalent data to what you have. Sorry, I missed that there were no records for months without any values.

 

I'm using 2 tables to solve the problem. The Value-data and a time dimension. You'll create the time dimension by going to "Modeling" in the menu, then click "New Table". This will send you to a dax formula, where you should write the following:

 

TimeDimCumulative = CALENDAR(FIRSTDATE('Cumulative Total'[Dato]);LASTDATE('Cumulative Total'[Dato]))

 

you'll see pictures of my data in the bottom of my reply. 

 

So the DAX formula for the cumulative sum is slightly different now, since we are now using the time dimension. It goes like this:

 

Cumulative total = CALCULATE(SUM('Cumulative Total'[Value]);FILTER(ALL('Cumulative Total'[Dato]); 'Cumulative Total'[Dato] <= MAX ( TimeDimCumulative[Date] )))

 

Having dates from the time dim plotted into a table and writing the DAX formula this way, the table will show values for the missing dates. See the last picture for the solution.

 

I hope this solves your problem. Let me know, if I need to elaborate on anything, or if I misunderstood your challenge. Then we'll work together to solve it.

 

Best,

Martin

 

 

Cumulative total - Data.pngCumulative total - time dim.png

Cumulative total final solution.png

 

View solution in original post

12 REPLIES 12

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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