cancel
Showing results for
Did you mean:

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

Helper III

## undefined

Hi, people.

How to calculate acumulative per month using the measure below

``````Lost =
VAR VarCustomerTotal =
CALCULATETABLE(
SELECTCOLUMNS(
dClientes,
"IDClienteMatriz",
dClientes[IDCliente]
),
ALL('dCalendário'),
dClientes[Matriz] = "Não"
)
VAR Result =
CALCULATETABLE(
, PREVIOUSMONTH('dCalendário'[Data])
, FILTER(
ALL('dCalendário')
, 'dCalendário'[Data] < MAX('dCalendário'[Data])
)
)
RETURN
COUNTROWS(EXCEPT(Result, VarCustomerTotal)) ``````

1 ACCEPTED SOLUTION
Community Support

Hi @CSpina

You can try the following code I have modified

``````Measure 2 = var _addcolumns=ADDCOLUMNS(ALLSELECTED('Table'),"Measure",[Measure])

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

3 REPLIES 3
Community Support

Hi @CSpina

You can refer to the following example:

You can create a new column in table first:

``````Mon_num = SWITCH([Month],
"Jan", 1,
"fev",2,
"mar",3,
"abr",4,
"mai",5,
"Jun",6,
"Jul",7,
"ago",8,
"Set",9,
"out",10,
"Nov",11,
"Dez",12
)``````

Then create a measure:

``Measure 2 = SUMX(FILTER(ALL('Table'),[Year]=MAX('Table'[Year])&&[Mon_num]<=MAX([Mon_num])),[Measure])``

Output:

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helper III

Thanks Yolo.

Your solution is very good but due to the calculations in the measure I am getting other results.

Community Support

Hi @CSpina

You can try the following code I have modified

``````Measure 2 = var _addcolumns=ADDCOLUMNS(ALLSELECTED('Table'),"Measure",[Measure])

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.

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