Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Teachjanderson
New Member

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 falling between the 15th of this month and next month would be assigned to the next disbursement date unless either of those dates fall on the weekend, then they move to the next business day. (4/15/2023 becomes 4/17/2023 so customers with disbursements on 15th are then counted if between 4/17-5/15 and so on). I'd like to create an expected disbursement date for each transaction. 

Looking for the best way to model and create this in BI. Appreciate tips or examples of creating this for each of the customers and their various disbursement dates. 

1 ACCEPTED SOLUTION
danextian
Super User
Super User

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]
    )

danextian_0-1688216863200.png

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] )
    )
)

danextian_1-1688217119215.png

 

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

1 REPLY 1
danextian
Super User
Super User

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]
    )

danextian_0-1688216863200.png

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] )
    )
)

danextian_1-1688217119215.png

 

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors