How to take a sum of monthly amount(of same pay period) and compare it with total amount and if total amount is not matching with sum of monthly amount then need to delete the row to make the sum of monthly amount and total amount equals of same pay period.
In this example…if we take 05/09/2023-08/12/2023 pay period and do sum of monthly amount…its equals to 1900, so here we need to delete the 5th & 7th row then it will be equals to total amount…How to implement this logic…Please advise.
Hi @Riya1,
The sum of monthly amount for the 05/09/2023-08/12/2023 is 2100, that is from cell B2:B7,
and may I know which you are referring as total amount in this table so that I would be able to help you out with the logic.
As per your requirement you need to code it this way:
Find the distinct Pay periods
Iterate each pay period
a) Filter the initial data table with currentItem
b) Find the difference in months in the current Payperiod
c) Check if FilteredData has rows equal to months+1 (from step b) if not
1a) Check if the total of all rows of column 2 (month amount ) is equal to any value of annual amount
2a) If not then see how much difference of rows and payperiod months and try to remove those many rows but keeping in mind the sum of row month should be equal to excess amount from annual amount.
Can you please share the dependency version as well?
I have tried your code but getting error as dependency version is different.Just FYI, I am using c# language.