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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
ShirinKaramifar
Regular Visitor

Subtracting one cell from previous cell in the same column

Hello everyone,

 

I have a question regarding to DAX formula. I want to calculate the percentage difference of a cell with respect to its previous in the same column in a matrix for Q--- columns. Which means subtracting the value by the value of the the above cell and divide the answer by the above cell value. It should be mention that the values in the CID column is repeated and are not unique.

Capture.PNG

 
 
1 ACCEPTED SOLUTION
dax
Community Support
Community Support

Hi @ShirinKaramifar , 

You could refer to my sample for details.

Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
dax
Community Support
Community Support

Hi @ShirinKaramifar , 

You could refer to my sample for details.

Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

It seems that my problem still remains and I am facing to new problem because,  in reality in my report Amount is just a measure not a cloumn and I am getting Code and arribute and CID from three different tables and I dont have all of them in one single table and I can not use the exact way which you applied for calculating the subtract cell. in this situation what are you suggesting? 

thank you in advance

 

Hi @ShirinKaramifar , 

Could you please use virtual data (not real data) to create your measure, and upload your pbix file? Then I will try to re-produce this design in my environment.

 

Please do mask sensitive data before uploading.

Thanks for your understanding and support.
Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

this is a simplified sample of what I am doing and now  I want to calculate the percentage difference of the measure X2 of  CID 1902 respecto to 1901 (each CID from the previouse CID)  for each code.

I think I dont have an access to upload anything here so I am putting a linke for my example

 

https://drive.google.com/open?id=10nNqsoKqnSmzUg9iHAaYwOPdzCuicWIN

 

Thank you inadvance

Best regards

Shirin

thank you so much for your usful solution. it is exactly what I meant and what I wanted.

edhans
Super User
Super User

There is no "above" in DAX or Power Query. Data is just data, and the sort means nothing to how you reference it. You would need a unique field (index?) and how you define what is "above" or "below" a given row. 



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors