Forum Discussion
DateAdd numbers interval based on column
Hi,
I have an issue I can't seem to find my way in.
I'm trying to have a variable interval number in DATEADD
My data is along the following lines:
Invoice:
DispatchDate | Conditiondays | Amount | etc...
DateTable
Date | etc...
Currently I have a calculated measure:
SumAmount = CALCULATE ( SUM ( Amount ), USERELATIONSHIP ( DateTable[Date], Invoice[DispatchDate] ) )
In the next measure I want to do the following but this does not work:
CALCULATE ([SumAmount], DATEADD ( DateTable[Date], Conditiondays, Day ) )
Is it possible to get this to work?
Anonymous You may find this helpful - https://community.powerbi.com/t5/Community-Blog/To-bleep-With-Time-Intelligence/ba-p/1260000
Also, see if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.
https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TITHW/m-p/434008
5 Replies
- Greg_DecklerCommunity Champion
Anonymous You may find this helpful - https://community.powerbi.com/t5/Community-Blog/To-bleep-With-Time-Intelligence/ba-p/1260000
Also, see if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.
https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TITHW/m-p/434008- AnonymousNot applicable
Thanks Greg, I'll dive into your dateadd part in a bit and see if it helps me out!
- amitchandakSuper User
Anonymous , in the measure you can have like
CALCULATE ([SumAmount], DATEADD ( DateTable[Date], max(Invoice[Conditiondays]), Day ) )
What are you trying to achieve here ?
- AnonymousNot applicable
Hi amitchandak ,
Thanks but this does not work as intended.
I have multiple dates in the invoice table. Like pay date, creation date and dispatchdate.
I want to forecast based on the dispatchdate + condition days after how many days you can expect x amount.
Below the outcome. Your option was used in the last column.30 manual is CALCULATE ([SumAmount], DATEADD ( DateTable[Date], 30, Day ) ), which should be the eventual outcome.
Edit: Actually my first measure also does not seem to work properly
The top date should be 30 days after the bottom date, which somehow is -30 days.. After putting a - before it in the formula it was fixed.
- v-robertq-msftCommunity Support
Hi, Anonymous
Has the documents that Greg posted helped you to found a solution?
If so, would you like to mark his reply as a solution so that others can learn from it too?
If not, you can post some sample data so that we can help you in advance.
Thanks in advance!
How to Get Your Question Answered Quickly
Best Regards,
Community Support Team _Robert Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.