Forum Discussion
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
- Anonymous4 years ago
Hi Russ99 ,
My sample is as below.
Table1:
Table2:
Relationship:
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.
Best Regards,
Rico ZhouIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
5 Replies
- lbendlinSuper 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.
- AnonymousNot applicable
Hi Russ99 ,
My sample is as below.
Table1:
Table2:
Relationship:
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.
Best Regards,
Rico ZhouIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.