Forum Discussion
Syndicate_Admin
Administrator
4 years agoCalculate Percentage Last Increase
Hello!
I have the following information in the dataset. My datasets are distinguished from month to month by the "last day of the month" column.
| Employee ID | Last day of the month | Last Increase | Monthly Total |
| 100 | 31/1/2022 | 1/8/2021 | 1000 |
| 100 | 28/2/2022 | 1/2/2022 | 1500 |
| 100 | 31/3/2022 | 1/2/2022 | 1500 |
| 200 | 31/1/2022 | 1/8/2021 | 1000 |
| 200 | 28/2/2022 | 1/2/2022 | 1500 |
| 200 | 31/3/2022 | 1/3/2022 | 1700 |
I need to be able to calculate the % of the last increment of each employee ID and then put it in a table, is there a way to do it? The result I need to get would be as follows:
| Employee ID | Last day of the month | Last Increase | Monthly Total | Last % increase |
| 100 | 31/1/2022 | 1/8/2021 | 1000 | 0% |
| 100 | 28/2/2022 | 1/2/2022 | 1500 | 50% |
| 100 | 31/3/2022 | 1/2/2022 | 1500 | 50% |
| 200 | 31/1/2022 | 1/8/2021 | 1000 | 0% |
| 200 | 28/2/2022 | 1/2/2022 | 1500 | 50% |
| 200 | 31/3/2022 | 1/3/2022 | 1700 | 13% |
Thank you!!
1 Reply
- tamerj1
Community Champion
Hi Syndicate_Admin
Here is a sample file with the solution https://www.dropbox.com/t/VxePA5I71I36fxizLast % increase = VAR CurrentDate = Payroll[Last day of the month] VAR CurrentSalary = Payroll[Monthly Total] VAR CurrentEmployeeTable = CALCULATETABLE ( Payroll, ALLEXCEPT ( Payroll, Payroll[Employee ID] ) ) VAR DatesBeforeTable = FILTER ( CurrentEmployeeTable, Payroll[Last day of the month] < CurrentDate ) VAR PreviousDate = MAXX ( DatesBeforeTable, Payroll[Last day of the month] ) VAR PreviousSalay = MAXX ( FILTER ( DatesBeforeTable, Payroll[Last day of the month] = PreviousDate ), Payroll[Monthly Total] ) RETURN DIVIDE ( CurrentSalary - PreviousSalay, PreviousSalay, 0 )