cancel
Showing results for
Did you mean:

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

Anonymous
Not applicable

## How to subtract previous month data with specific category

Hi,

I'm very new to this PowerBI and I need your help.

So I have this data of variable cost and revenue from different products and different month. So I want to subtract the Q1 Value from 2nd month and previous month for each product. For example for Variable cost for biscuit the difference is 6000 (this month) - 5000 (last month) = 1000.

The desired outcome is shown on the right column.

Kindly need your help on this.

Thank you

1 ACCEPTED SOLUTION
Solution Sage

Hi @Anonymous ,

Create a measure like this:

`Desired Result = var previousmonthvalue=CALCULATE(SUM(Data[Q1]),FILTER(ALLEXCEPT(Data,Data[Status],Data[Product]),Data[Month]=SELECTEDVALUE(Data[Month])-1))return IF(ISBLANK(previousmonthvalue),0,SUM(Data[Q1])-previousmonthvalue)`

This will give you the desired output:

Appreciate a Kudos 😀

3 REPLIES 3
Anonymous
Not applicable

Dear @Tanushree_Kapse & @jaideepnema

Thank you so much it really helps!

Solution Sage

Hi @Anonymous ,

Create a measure like this:

`Desired Result = var previousmonthvalue=CALCULATE(SUM(Data[Q1]),FILTER(ALLEXCEPT(Data,Data[Status],Data[Product]),Data[Month]=SELECTEDVALUE(Data[Month])-1))return IF(ISBLANK(previousmonthvalue),0,SUM(Data[Q1])-previousmonthvalue)`

This will give you the desired output:

Appreciate a Kudos 😀

Impactful Individual

Hi @Anonymous ,

Previous month Sale= CALCULATE(SUM(Table(Q1), PARALLELPERIOD(Table(Month), -1, Month)

Current month= SUM(Table(Q1))
Difference= Current month - Previous month Sale

Mark this as a solution, if I answered your question. Kudos are always appreciated.

Thanks!

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
Users online (814)