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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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

Top Solution Authors