cancel
Showing results for
Did you mean:
Highlighted
Member

## Calculating Quantity Sold last month & two months ago?

Hello,

I am trying to calculate total quantity sold the last month and two months ago, but it is giving me wrong quantity. Can anybody please tell me whats wrong or take a look at my sample file. I really appreciate your help.

Formula -

```One Month Ago = CALCULATE([Total Sold Quantity], DATEADD('Date'[Day], -1,MONTH))
Two Month Ago = CALCULATE([Total Sold Quantity], DATEADD(TestDataForSales[Day], -2,MONTH))```

Thank you so much

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team

## Re: Calculating Quantity Sold last month & two months ago?

Hi @danzidpp,

Based on my test, you can refer to below steps:

1.Create two measures to create your “one month ago data” and the “two month ago data”

New One month ago = CALCULATE (

SUM(TestDataForSales[Quantity]),

PARALLELPERIOD('TestDataForSales'[Day],-1,MONTH))-

CALCULATE (

SUM(TestDataForSales[Quantity]),

PARALLELPERIOD('TestDataForSales'[Day],-2,MONTH))

New Two month ago = CALCULATE (

SUM(TestDataForSales[Quantity]),

PARALLELPERIOD('TestDataForSales'[Day],-2,MONTH))-

CALCULATE (

SUM(TestDataForSales[Quantity]),

PARALLELPERIOD('TestDataForSales'[Day],-3,MONTH))

2.Create a Table visual and add the [Products], [SKU], [New One month ago] and [New Two month ago] fields.

3.Create two card visuals and add the [New One month ago] and [New Two month ago] fields.

Now you can see the result.

https://www.dropbox.com/s/q4l1cjnor65nzgp/Calculating%20Quantity%20Sold%20last%20month%20%26%20two%2...

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
4 REPLIES 4
Super User

## Re: Calculating Quantity Sold last month & two months ago?

i dont see any issues with your formula .

I hope your total sold qty is SUM( QTY) to make your calculation as shown below.

Thanks

Raj

Community Support Team

## Re: Calculating Quantity Sold last month & two months ago?

Hi @danzidpp,

Based on my test, you can refer to below steps:

1.Create two measures to create your “one month ago data” and the “two month ago data”

New One month ago = CALCULATE (

SUM(TestDataForSales[Quantity]),

PARALLELPERIOD('TestDataForSales'[Day],-1,MONTH))-

CALCULATE (

SUM(TestDataForSales[Quantity]),

PARALLELPERIOD('TestDataForSales'[Day],-2,MONTH))

New Two month ago = CALCULATE (

SUM(TestDataForSales[Quantity]),

PARALLELPERIOD('TestDataForSales'[Day],-2,MONTH))-

CALCULATE (

SUM(TestDataForSales[Quantity]),

PARALLELPERIOD('TestDataForSales'[Day],-3,MONTH))

2.Create a Table visual and add the [Products], [SKU], [New One month ago] and [New Two month ago] fields.

3.Create two card visuals and add the [New One month ago] and [New Two month ago] fields.

Now you can see the result.

https://www.dropbox.com/s/q4l1cjnor65nzgp/Calculating%20Quantity%20Sold%20last%20month%20%26%20two%2...

Regards,

Daniel He

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

## Re: Calculating Quantity Sold last month & two months ago?

@v-danhe-msft

Hello,

This works and it makes sense.  Thank you so much for the time and help.

Member

## Re: Calculating Quantity Sold last month & two months ago?

@rajendran

Hello,

Thank you for the help and time.  We have to minus months.