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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
RuchiSharma
Frequent Visitor

Need to subtract from Previous row result to another column value.

Minimum product : Min(table[ Prod Name])

Min Prod Value=

Base-CALCULATE(sum('Table'[qty]),FILTER('Table','Table'[Oesc]=MIN('Table'[Oesc])))

"quantity (-) minimum prod value for ex: (10-0.02=9.98)

Need to consider the output of this previous row result (-) qty Ex: (9.98-0.03=9.95)

Formula: 10-0.02=9.98
9.98-0.03=9.95
9.95-0.04=9.91
9.91-0.05=8.86

RuchiSharma_0-1688112538603.png

 



 

2 ACCEPTED SOLUTIONS
MFelix
Super User
Super User

Hi @RuchiSharma ,

 

For this you need to add a measure similar to this one:

Output = SUM('Table'[Base]) - CALCULATE(SUM('Table'[Qty]), 'Table'[Product NAme] <= MIN( 'Table'[Product NAme]))

MFelix_0-1688197984247.png

Be aware that since the product names are in alphabeticle order the measure works properly, I believe that in your real data you will have an ID column so use that instead of the name on  the measure.

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

Hi,

Please download my solution file.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

11 REPLIES 11
RuchiSharma
Frequent Visitor

Hi @MFelix @Ashish_Mathur 
Slide changes came in the requirement Instead of subtraction we need multiplication can you please help me with how we can achieve this? Please refer below picture. I replaced the product name with Index so we can consider the index column as a product name.

RuchiSharma_0-1688623589471.png

 





  

Hi,

Please find attached my solution file.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi Ashish,
Can you please check answer is different.
I need an answer as per the below picture.
For Example:
0.02=0.2
0.0006=0.006

RuchiSharma_2-1688699629336.png

 

 

Hi,

Please find attached the PBI file.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Ashish_Mathur
Super User
Super User

Hi,

What's the criteria for determining the next row?  I am sure it is not the product name.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi @Ashish_Mathur 
It is the product name 
I have attached a screenshot for your reference 

RuchiSharma_0-1688271276270.png

 

RuchiSharma_1-1688271320359.png

Also, I mentioned the formula.

Hi,

Please download my solution file.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thank you so much @Ashish_Mathur  your Solution is working fine.❤

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
MFelix
Super User
Super User

Hi @RuchiSharma ,

 

For this you need to add a measure similar to this one:

Output = SUM('Table'[Base]) - CALCULATE(SUM('Table'[Qty]), 'Table'[Product NAme] <= MIN( 'Table'[Product NAme]))

MFelix_0-1688197984247.png

Be aware that since the product names are in alphabeticle order the measure works properly, I believe that in your real data you will have an ID column so use that instead of the name on  the measure.

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



@Thank you So much @MFelix  Yes your solution is working fine ❤ 

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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