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
kaytrishjr
Frequent Visitor

DAX Formula for a cumulative line graph

I've read a couple of posts on how to do this but I still can't make mine work. I need the correct DAX formula to make my line graph figures cumulative by period. It's really the filter part of the formula I'm getting confused with. Here are my examples:

 

This is an example of the information I would be using;

Line graph info.JPG


This is the line graph I need and need the totals to be cumulative. 

PI Line graph.JPG

 

Thanks for your help!

 
 

 

 

 

 

 

 

 

 

2 ACCEPTED SOLUTIONS
AntrikshSharma
Community Champion
Community Champion

The X axis, are those months? A general running total pattern is like this. Try modifying it according to your needs and let me know.

Running Total =
CALCULATE (
    [Total Sales],
    FILTER ( ALL ( 'Date' ), 'Date'[Date] <= MAX ( 'Date'[Date] ) )
)

 

View solution in original post

v-diye-msft
Community Support
Community Support

Hi @kaytrishjr 

 

Added on the above posts, if there's no date column could be using for [date]<=max(table(date)), you can just take the period column as index, and create the measure similar as:

 

Running Total =
CALCULATE (
    [Total Sales],
    FILTER ( ALL ( 'Table' ), 'Table'[period] <= MAX ( 'Table'[period] ) )
)
Community Support Team _ Dina Ye
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

3 REPLIES 3
v-diye-msft
Community Support
Community Support

Hi @kaytrishjr 

 

Added on the above posts, if there's no date column could be using for [date]<=max(table(date)), you can just take the period column as index, and create the measure similar as:

 

Running Total =
CALCULATE (
    [Total Sales],
    FILTER ( ALL ( 'Table' ), 'Table'[period] <= MAX ( 'Table'[period] ) )
)
Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.
AntrikshSharma
Community Champion
Community Champion

The X axis, are those months? A general running total pattern is like this. Try modifying it according to your needs and let me know.

Running Total =
CALCULATE (
    [Total Sales],
    FILTER ( ALL ( 'Date' ), 'Date'[Date] <= MAX ( 'Date'[Date] ) )
)

 

@kaytrishjr ,

For Cumulative COlumn use the below DAX:

Column = CALCULATE(SUM(Table[SalesColumn]),ALL(Table),Table[DateColumn]<=EARLIER(Table[DateColumn]))

For Cumulative MEasure use the below DAX:

Measure = CALCULATE(SUM(Table[SalesColumn]),FILTER(ALL(Table),Table[DateColumn]<=Max(Table[DateColumn])))

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard

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.