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
Russ99
Helper I
Helper I

dax formula

Hi Community,

 

I need some help writing a formula that will calculate when a customer is meant to pay for an item. The date they are meant to pay depends on 2 things, how many days their payment terms are and whether these terms are net or end of month. I have one column called "net or eom" and one called "payment terms"

 

The formula I have drafted on paper, that doesnt work in power BI is as below. 

 

date customer meant to pay = if([net or eom]="net",[transaction date] + [payment terms]),(EOMONTH([transaction date],0)+[payment terms]

 

ideally my output should be in the format dd/mm/yyyy.

 

I think the reason it is not working is becuase i dont have explicit measures, i am not sure what arguments i need to change to explicit measures and how to do so

i think it also worth mentioning that currently these are all colums and none are measure. also colum [transaction date] is in one table and [payment terms] and [net or eom] sit in a different table. the tables are related by customer name.

 

thanks for all of your help!!

 

Russ 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Russ99 ,

 

My sample is as below.

Table1:

1.png

Table2:

2.png

Relationship:

1.png

Measure:

date customer meant to pay =
VAR _Payment_terms =
    SUM ( Table2[payment terms] )
VAR _net_or_eom =
    MAX ( Table2[net or eom] )
VAR _Transaction_Date =
    MAX ( Table1[Transaction Date] )
RETURN
    IF (
        _net_or_eom = "net",
        _Transaction_Date + _Payment_terms,
        EOMONTH ( _Transaction_Date, 0 ) + _Payment_terms
    )

Result is as below.

1.png

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hi @Russ99 ,

 

My sample is as below.

Table1:

1.png

Table2:

2.png

Relationship:

1.png

Measure:

date customer meant to pay =
VAR _Payment_terms =
    SUM ( Table2[payment terms] )
VAR _net_or_eom =
    MAX ( Table2[net or eom] )
VAR _Transaction_Date =
    MAX ( Table1[Transaction Date] )
RETURN
    IF (
        _net_or_eom = "net",
        _Transaction_Date + _Payment_terms,
        EOMONTH ( _Transaction_Date, 0 ) + _Payment_terms
    )

Result is as below.

1.png

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

this has worked really well for a lot of my data so thanks so much for that. however the measure customer meant to pay is throwing out some results in the year 2117 and some in the year 1900, do you know why this could be?

Customers without transaction dates?

nope, there are no blanks. i was wondering if was perhaps adding the amount of days to the year or month instead of the full date however this does not seem to be right.

lbendlin
Super User
Super User

Please provide sanitized sample data that fully covers your issue. Paste the data into a table in your post or use one of the file services. Please show the expected outcome.

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!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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