Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
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

 

GDENITA_0-1632716586309.png

 

1 ACCEPTED SOLUTION
jaideepnema
Solution Sage
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:

jaideepnema_0-1632719431746.png

Please accept this as a solution if your question has been answered !!

Appreciate a Kudos 😀

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Dear @Tanushree_Kapse & @jaideepnema 

Thank you so much it really helps!

jaideepnema
Solution Sage
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:

jaideepnema_0-1632719431746.png

Please accept this as a solution if your question has been answered !!

Appreciate a Kudos 😀

Tanushree_Kapse
Impactful Individual
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!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.