cancel
Showing results for
Did you mean:

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Frequent Visitor

## Running Values with Month and Value

Hi.

I have a problem creating a Running Value in DAX. I need to group by month and value (for this case a Project) but most of the solutions in the community forum are releated to grouping by date and not by date and value as i need in this case.

For example:

The correct Running Value for me must be by month and Project , for example:

I used this DAX formulas:

AcumT = CALCULATE(SUM(PptoxMes[Presupuesto]);FILTER(PptoxMes;PptoxMes[Month_Num]<=EARLIER(PptoxMes[Month_Num]));PptoxMes[Año]="2015";values(PptoxMes[Proyecto]))

and this:

AcumT = CALCULATE(SUM(PptoxMes[Presupuesto]);FILTER(PptoxMes;PptoxMes[Month_Num]<=EARLIER(PptoxMes[Month_Num])))

and this solution:

http://community.powerbi.com/t5/Desktop/DAX-Running-total-by-another-column/td-p/10512

and nothing works for me.

Thanks a lot.

2 ACCEPTED SOLUTIONS
Super User

Hi there,

For a running total in a DAX calculated column, I find the safest way is to use ALLEXCEPT to ensure that only the columns you specify remain in the filter context for each running total.

In your case I would use:

```AcumT =
CALCULATE (
SUM ( PptoxMes[Presupuesto] );
ALLEXCEPT ( PptoxMes; PptoxMes[Año]; PptoxMes[Projecto] );
PptoxMes[Month_Num] <= EARLIER ( PptoxMes[Month_Num] )
)```

Does that do the trick?

Owen 🙂

Owen Auger
Blog
Community Champion

@cardonasebast Look at the picture... Both of my formulas are Measures.

EDIT: You should probably add the Year field in the Matrix like this... so data is not aggregated by Month for all years

2 REPLIES 2
Community Champion

@cardonasebast Look at the picture... Both of my formulas are Measures.

EDIT: You should probably add the Year field in the Matrix like this... so data is not aggregated by Month for all years

Super User

Hi there,

For a running total in a DAX calculated column, I find the safest way is to use ALLEXCEPT to ensure that only the columns you specify remain in the filter context for each running total.

In your case I would use:

```AcumT =
CALCULATE (
SUM ( PptoxMes[Presupuesto] );
ALLEXCEPT ( PptoxMes; PptoxMes[Año]; PptoxMes[Projecto] );
PptoxMes[Month_Num] <= EARLIER ( PptoxMes[Month_Num] )
)```

Does that do the trick?

Owen 🙂

Owen Auger
Blog

Announcements

#### Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

#### Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

#### 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!

#### The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors