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
monkeyintheeast
New Member

how to generate cumulative totals?

I have a dataset of hours worked per month, and i'd like to plot a bar and line graph showing hours per month on the bar chart, and cumulative hours on the line graph.

 

I've two questions that I would be greateful of assistance with please...

 

1. The x-axis of my chart only goes from January to December. How do i get it to show the full three year dataset?

 

2, What is the best way to generate the cumulative line? I'm new to this, so i'd be grateful of the education please!

 

Thank you

1 ACCEPTED SOLUTION
Anand24
Super User
Super User

Hi @monkeyintheeast ,

 

Ans 1: You can use both year and date from the date for getting all 36 months in the X-axis.

 

Ans 2: You can create a new measure with below dax for cumulative total and use this new measure in line chart:

New Measure=

CALCULATE(

Sum(Hours),

FILTER(

ALLSELECTED(Date),

Date <= MAX(Date)

)

)

 

Give a thumbs up if this post helped you in any way and mark this post as solution if it solved your query !!!

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@monkeyintheeast , You Should use month year on your x- axis

In case you have date else have these

Month Year = FORMAT([Date],"mmm-yyyy")
Month Year sort = FORMAT([Date],"yyyymm") // Sort month year on this format.

 

It better to have a date table or month table with month rank or YYYYMM year

Example of Cumulative

Cumm Sales = CALCULATE(SUM(Sales[Sales Amount]),filter(allselected(date),date[date] <=max(date[date])))

Or

Cumm Sales = CALCULATE(SUM(Sales[Sales Amount]),filter(allselected(date),date[Month Year sort] <=max(date[Month Year sort])))

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

 

Anand24
Super User
Super User

Hi @monkeyintheeast ,

 

Ans 1: You can use both year and date from the date for getting all 36 months in the X-axis.

 

Ans 2: You can create a new measure with below dax for cumulative total and use this new measure in line chart:

New Measure=

CALCULATE(

Sum(Hours),

FILTER(

ALLSELECTED(Date),

Date <= MAX(Date)

)

)

 

Give a thumbs up if this post helped you in any way and mark this post as solution if it solved your query !!!

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.