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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonyme94
Frequent Visitor

Power BI DAX Payment Run logic

Hi everyone, 
I'm reposting a request that has been addressed differently in the past : 

As per the client's account payable process, payment for all the due invoices are done as per the following payment cycle:

 

10th of every month

15th of every month

20th of every month

end of every month

 

For example :

If a invoice has due date of 2nd of month then it will be paid on 10th of that month and if a invoice has due date 12th of month then it will be paid on 15th of that month.

I'm struggling to determine the closest payment date based on due date. Are any of you faced this issue before ? 
Any suggestion would help to go further 🙂 

 

Thanks. 

2 ACCEPTED SOLUTIONS
johnt75
Super User
Super User

You could create a new column on your date table to flag whether a date is a payment date or not. You could create a column in DAX like

Is Payment Date =
DAY ( 'Date'[Date] )
    IN { 10, 15, 20 }
        || EOMONTH ( 'Date'[Date], 0 ) = 'Date'[Date]

or you could do it in Power Query or SQL depending on where your date table comes from.

You could then add a column to your invoices table to store the closest payment date, e.g.

Payment Date =
MINX (
    FILTER (
        ALL('Date'),
        'Date'[Is Payment Date] = TRUE ()
            && 'Date'[Date] >= 'Invoice'[Due Date]
    ),
    'Date'[Date]
)

View solution in original post

AmiraBedh
Super User
Super User

Hello !

Thank you for posting on Microsoft Fabric community.

You need to create a CC for each invoice due date in the same month:

  • If day ≤ 10 : pay on the 10th

  • Else if day ≤ 15 : pay on the 15th

  • Else if day ≤ 20 : pay on the 20th

  • Else : pay on EOM

PaymentRunDate = 
VAR d = DAY ( Invoices[DueDate] )
VAR y = YEAR ( Invoices[DueDate] )
VAR m = MONTH ( Invoices[DueDate] )
RETURN
IF (
    ISBLANK ( Invoices[DueDate] ),
    BLANK(),
    SWITCH (
        TRUE(),
        d <= 10, DATE ( y, m, 10 ),
        d <= 15, DATE ( y, m, 15 ),
        d <= 20, DATE ( y, m, 20 ),
        EOMONTH ( Invoices[DueDate], 0 )
    )
)

 

 

you can find the solution in the attached pbix.

 

 


Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696

View solution in original post

7 REPLIES 7
AmiraBedh
Super User
Super User

Hello !

Thank you for posting on Microsoft Fabric community.

You need to create a CC for each invoice due date in the same month:

  • If day ≤ 10 : pay on the 10th

  • Else if day ≤ 15 : pay on the 15th

  • Else if day ≤ 20 : pay on the 20th

  • Else : pay on EOM

PaymentRunDate = 
VAR d = DAY ( Invoices[DueDate] )
VAR y = YEAR ( Invoices[DueDate] )
VAR m = MONTH ( Invoices[DueDate] )
RETURN
IF (
    ISBLANK ( Invoices[DueDate] ),
    BLANK(),
    SWITCH (
        TRUE(),
        d <= 10, DATE ( y, m, 10 ),
        d <= 15, DATE ( y, m, 15 ),
        d <= 20, DATE ( y, m, 20 ),
        EOMONTH ( Invoices[DueDate], 0 )
    )
)

 

 

you can find the solution in the attached pbix.

 

 


Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696

Hi @AmiraBedh 

 

Magnifique !  Many thanks for your feedback, that works as expected

Glad to have helped 🙂


Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696
grazitti_sapna
Super User
Super User

Hi @Anonyme94,

Firstly let's assume end of month as last day of your month.

Assuming your table name is invoices and it has a duedate column as well.

Let's first create start and end date of the due date month i.e. 1st and last date of the month, and then extracting the nexy payment date based on the crieteira you mentioned.

 

You can use below DAX for the same.

 

NextPaymentDate =
VAR Due = Invoices[DueDate]
VAR DayOfMonth = DAY(Due)
VAR MonthStart = DATE(YEAR(Due), MONTH(Due), 1)
VAR EndOfMonth = EOMONTH(Due, 0)
RETURN
SWITCH(
TRUE(),
DayOfMonth <= 10, DATE(YEAR(Due), MONTH(Due), 10),
DayOfMonth <= 15, DATE(YEAR(Due), MONTH(Due), 15),
DayOfMonth <= 20, DATE(YEAR(Due), MONTH(Due), 20),
DayOfMonth > 20, EndOfMonth
)

 

🌟 I hope this solution helps you unlock your Power BI potential! If you found it helpful, click 'Mark as Solution' to guide others toward the answers they need.
💡 Love the effort? Drop the kudos! Your appreciation fuels community spirit and innovation.
🎖 As a proud SuperUser and Microsoft Partner, we’re here to empower your data journey and the Power BI Community at large.
🔗 Curious to explore more? [Discover here].
Let’s keep building smarter solutions together!

Hi @grazitti_sapna 

 

Merci beaucoup ! 
It works, thanks for the tips on splitting day, month & year 

johnt75
Super User
Super User

You could create a new column on your date table to flag whether a date is a payment date or not. You could create a column in DAX like

Is Payment Date =
DAY ( 'Date'[Date] )
    IN { 10, 15, 20 }
        || EOMONTH ( 'Date'[Date], 0 ) = 'Date'[Date]

or you could do it in Power Query or SQL depending on where your date table comes from.

You could then add a column to your invoices table to store the closest payment date, e.g.

Payment Date =
MINX (
    FILTER (
        ALL('Date'),
        'Date'[Is Payment Date] = TRUE ()
            && 'Date'[Date] >= 'Invoice'[Due Date]
    ),
    'Date'[Date]
)

Hi @johnt75 

Thanks a lot for your support and tips, it works ! 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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
Top Kudoed Authors