Forum Discussion
calculate days between two dates with calculate fields
I am new at this, I need some help with a calculated field please, at this moment I want to calculate:
=IF(VENTAS[SALDO VENCIDO TOTAL]>1,(TODAY()-VENTAS[FECHA VENCIMIENTO]),0)
How can I write it in DAX format or the power pivot format?
Thanks in advance!
6 Replies
- FreemanZ
Super User
hi Anonymous
you can add a calculated column with similar code:
Column =IF(VENTAS[SALDO VENCIDO TOTAL]>1,(TODAY()-VENTAS[FECHA VENCIMIENTO]),0)
- AnonymousNot applicable
And if I get a dependency error because (VENTAS[SALDO VENCIDO TOTAL] is equal to a CALCULATE[] (calculated field) what can I do next?- FreemanZ
Super User
hi Anonymous
can you make a screenshot of the error?
p.s. please consider @someone, if you seek further suggestions from someone.
- Ashish_Mathur
Super User
Hi,
Assuming SALDO VENCIDO TOTAL is a column in the VENTAS table, your calculated formula should work. You may have to multiply your formula with 1 to get the duration.
- AnonymousNot applicable
Ashish_Mathur yes it is, but doesnt work.
I have a new error, because errase the calculate and start again, now I have this message:
The calculate that I want to have is difference days between today and the due date, but I have a conditional if I have due balance >1. But Due Balance is a calculate column :
VAR SALDOVENCIDO =
CALCULATE(SUM(VENTAS_GMSG[VENTA])-SUM(PAGOS_CXC[DEPOSITO]),FILTER(CLIENTE,CLIENTE[CLIENTE]=VENTAS[CLIENTE]),FILTER(FACTURA,FACTURA[FACTURA]=VENTAS[FACTURA]),ALL('Calendar'),ALL(PAGOS_CXC))
RETURN
IF(SALDOVENCIDO<100,BLANK(),SALDOVENCIDO)