Forum Discussion
alexricker0928
5 years agoFrequent Visitor
Variable in DATEADD function
I'm trying to age certain dollar amounts based on the due date of the invoice. I have a 'before' date filter in my report that runs the report 'as of' whatever is selected. Let's say I run t...
- 5 years ago
alexricker0928 DATEADD is a table function and in the first argument it expects a list of dates, if for some reasons you had to go by your way you have to wrap it inside curly braces { CurrentDate }
try if this works:
CT Balance Last 30 Days = VAR CurrentDate = SELECTEDVALUE ( 'DimDate-InvoiceDate'[Date], MAX ( 'DimDate-InvoiceDate'[Date] ) ) RETURN CALCULATE ( SUM ( OpenARPrepayments[AmountMST] ), FILTER ( OpenARPrepayments, OpenARPrepayments[DueDate] < CurrentDate && OpenARPrepayments[DueDate] > CurrentDate - 30 ) )
AntrikshSharma
5 years agoCommunity Champion
alexricker0928 DATEADD is a table function and in the first argument it expects a list of dates, if for some reasons you had to go by your way you have to wrap it inside curly braces { CurrentDate }
try if this works:
CT Balance Last 30 Days =
VAR CurrentDate =
SELECTEDVALUE (
'DimDate-InvoiceDate'[Date],
MAX ( 'DimDate-InvoiceDate'[Date] )
)
RETURN
CALCULATE (
SUM ( OpenARPrepayments[AmountMST] ),
FILTER (
OpenARPrepayments,
OpenARPrepayments[DueDate] < CurrentDate
&& OpenARPrepayments[DueDate] > CurrentDate - 30
)
)
wlf0032
4 years agoFrequent Visitor
What if the situation requires the filter to be "CurrentDate - 1 Quarter". What can you do then? (different quarter has different number of days)
thank you!