cancel
Showing results for
Search instead for
Did you mean:
Helper I

## Cumulative monthly totals

Hi,

I have a Date table and fact table related by field called Year

I want to achieve a table like this:

 Year MonthNo sales Monthly Cumulative 2022 01 20 20 2022 02 30 50 2022 03 40 90 2022 04 50 140

I have used this dax to obtain this measure Monthly cumulative:

``````Monthly cumulative=
calculate(sum(sales),
filter(allselected('Date'),
'Date'[Dates]<=Max('Date'[Dates])))``````

But the result is

140

140

140

140

I want to this in a bar graph too.

How do i do this?

2 ACCEPTED SOLUTIONS
Super User

Hi,

I am not sure how your datamodel looks like, but please try something like below whether it suits your requirement.

``````Monthly cumulative =
CALCULATE (
SUM ( sales[revenue] ),
FILTER ( ALLSELECTED ( 'Date'[Dates] ), 'Date'[Dates] <= MAX ( 'Date'[Dates] ) )
)
``````

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.

Go to My LinkedIn Page

Solution Sage

Monthly cumulative =
calculate(sum(fact_table[Sales]),
filter(allselected('fact_table'),
'fact_table'[Month]<=Max('fact_table'[Month])))

please check your relationship of date and sale table and also filter direction of table.

3 REPLIES 3
Helper I

Thanks guys. I got the answer when I was just posting this question. However, the reply button deactivated, when I want to say.. I got the answer.

Thanks again for looking into it.

Solution Sage

Monthly cumulative =
calculate(sum(fact_table[Sales]),
filter(allselected('fact_table'),
'fact_table'[Month]<=Max('fact_table'[Month])))

please check your relationship of date and sale table and also filter direction of table.

Super User

Hi,

I am not sure how your datamodel looks like, but please try something like below whether it suits your requirement.

``````Monthly cumulative =
CALCULATE (
SUM ( sales[revenue] ),
FILTER ( ALLSELECTED ( 'Date'[Dates] ), 'Date'[Dates] <= MAX ( 'Date'[Dates] ) )
)
``````

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.

Go to My LinkedIn Page

## Helpful resources

Announcements

#### Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

#### Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

#### Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

#### Power Platform Conference-Power BI and Fabric Sessions

Join us Oct 1 - 6 in Las Vegas for the Microsoft Power Platform Conference.

Top Solution Authors
Top Kudoed Authors