cancel
Showing results for
Did you mean:
Highlighted
Frequent Visitor

## Substract 2 parts of an amount for a time period to the total amount (3 parts) of the previous month

Hello everyone,

Like 90% of the posts, I'm new to Power BI and I need you for the following :

I have a total amount (let's call it X) divided into three subcategories (A,B and C) over 10 periods (months from March to December 2018)

I need to show the difference between A+B  April (04/2018) with A+B+C (X) March (03/2018)

I created a Time Table, but I can't find how to make the calculation.

I tried to create an Index from 0 to 9 for each month and do a 3 lines long DAX formula with IFs.

Thank you for your help and sorry for the English

Abasse

3 REPLIES 3
Community Support Team

## Re: Substract 2 parts of an amount for a time period to the total amount (3 parts) of the previous m

Hi @APIRBAY ,

I would appreciate it if you could share some data sample and your desired output so that I could understand your scenario better and help further on it.

Best Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Frequent Visitor

## Re: Substract 2 parts of an amount for a time period to the total amount (3 parts) of the previous m

Here's a screenshot of the graph that i have and the relating data.

What I want is a column with 0 for the first month and then this calculation : CURRENT MONTH ["V-OP Mois"+ "Provision" + "Réel"]  - PREVIOUS MONTH ["Provision" + "Réel"]

Community Support Team

## Re: Substract 2 parts of an amount for a time period to the total amount (3 parts) of the previous m

Hi @APIRBAY ,

```Measure =
VAR cur_A =
CALCULATE ( SUM ( 'Table'[A] ) )
VAR cur_B =
CALCULATE ( SUM ( 'Table'[B] ) )
VAR cur_C =
CALCULATE ( SUM ( 'Table'[C] ) )
VAR pre_A =
CALCULATE (
SUM ( 'Table'[A] ),
FILTER ( 'Table', DATEADD ( 'Table'[Date], -1, MONTH ) )
)
VAR pre_B =
CALCULATE (
SUM ( 'Table'[B] ),
FILTER ( 'Table', DATEADD ( 'Table'[Date], -1, MONTH ) )
)
VAR pre_C =
CALCULATE (
SUM ( 'Table'[C] ),
FILTER ( 'Table', DATEADD ( 'Table'[Date], -1, MONTH ) )
)
RETURN
cur_A + cur_B + cur_C - ( pre_A + pre_C )
```

If you still need help, please share your sample data with table format and your your desired output so that we could copy and have a test on it.

Best  Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.