Forum Discussion

Teachjanderson's avatar
Teachjanderson
New Member
3 years ago
Solved

Transactions between dates with weekends

I'm bringing in transactions which are disbursed on different days of the month depending on the customers program (1st, 15th, 21st, 28th, last day of the month, etc). For example, any transactions f...
  • danextian's avatar
    3 years ago

    Hi Teachjanderson ,

     

    You can calculate for the day of week of day name a disbursement date is and move it to the next weekday. That would be +1 for Sun and +2 for Saturday.

    =
    VAR __DAY_OF_WEEK =
        WEEKDAY ( DisbursementDates[Disbursement date], 1 )
    RETURN
        SWITCH (
            __DAY_OF_WEEK,
            1, DisbursementDates[Disbursement date] + 1,
            7, DisbursementDates[Disbursement date] + 2,
            DisbursementDates[Disbursement date]
        )

    As for the expected disbursement date of each transaction and following that if the  date is 4/15 the disbursement date would be 4/17, you can calculate for the earliest expected disbursement date that is greater than the  current transaction date.

    =
    CALCULATE (
        MIN ( DisbursementDates[Expected Disbursement Date] ),
        FILTER (
            DisbursementDates,
            DisbursementDates[Expected Disbursement Date]
                > EARLIER ( TransactionDates[Transaction date] )
        )
    )