How to deduct an amount based off of the date

I have a total sum of £1000 and a start date of 1st Jan i will deduct £20 every 1st of the month. how can implement it that a number of days can be added to the the initial date to and based off of that calculate how much should be deducted.

Scenario example:

Total amount £1000
initial amount to be deducted £20
start date 1st Jan
delay date 31 days

so the solution should deduct £20 at the start and then because its now the 1st feb it will deduct £40 and if it was 1st march it will be £60…etc

what would be the best way to do this

@duaine.b

Multiple 20 with month and subtract it

Before that check if todays date is first

cheers

Hi @duaine.b ,

Does the statement above mean the total amount deducted was 60 (20 for Jan + 40 for Feb) ?

Hi @supermanPunch correct

@duaine.b ,

Not sure as to what types the date values are present (DateTime or String). Assuming they are string types, we can check with the below expression :

StartDate = "01/01/2023"
InitialAmount = 20

AmountDeducted = Enumerable.Range(1,CInt(DateDiff(DateInterval.Month,CDate(StartDate),Now.Addmonths(1)))).Sum(Function(x)x*InitialAmount)

Visuals (Hard Coded Values) :
image

In the above Expression the delay date was considered to be a Month, not in days as it was assumed it was a better choice.

However, Test the above expression with different values and let us know if there happens to get a wrong answer.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.