March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi Everyone,
I have a requirement to calculate the difference (%) based on previous row value, The condition is first sort the rows based on start date, if we have two rows with same start date it should pick based on lot number and we have to get the Previous Value based on the row previous value and compute Difference (%).
As I am a new to DAX, please can you help in writing dax logic.
Test data:
Start_Date | lot Number | P(%) | Previous Value | Difference (%) |
01-03-2023 | 10001837289 | 4.13 | 0 | (P(%)-Previous Value)/ Previous Value |
01-03-2023 | 10001837614 | 4.14 | 4.13 | |
02-03-2023 | 10001839183 | 4.14 | 4.14 | |
02-03-2023 | 10001839185 | 4.17 | 4.14 | |
03-03-2023 | 10001839213 | 4.23 | 4.17 | |
04-03-2023 | 10001840158 | 4.14 | 4.23 |
Regards,
Sundar.
@SundarKumar , the offset function can help
Continue to explore Power BI Offset Compare Categories, Time Intelligence MOM, QOQ, and YOY: https://youtu.be/5YMlkDNGr0U
Dear Amit,
Thank you for the solution but small change in requirement that after sorting the rows based on Start date and lot number, we need to consider the first row as base and get the difference from remaining rows. In my example we need to consider 4.13 as base and 4.13 should come in Previous value feild and compute difference based on 4.13 value.
Regards,
Sundar
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
128 | |
90 | |
75 | |
56 | |
53 |
User | Count |
---|---|
200 | |
104 | |
101 | |
67 | |
55 |