Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Greetings,
I have a seemingly simple need but cannot seem to figure it out and have been racking my brain for days - DAX and I are not getting along.
I'm connected to my data from Dynamics365. Using the opportunities[est...date] field I need to add a duration (months).
First, I take the date and perform a STARTOFMONTH() calculation then add 2 months and store in a measure. I've got this.
[est...date] = 1/10/2020
mthlyRevBegin = 3/1/2020
Here's my issue. I need to add 10 months to the [est...date] and then subtract 1 day to capture 10 whole months. PowerBI doesn't seem to let me nest DATEADD() or other functions nor can I use a measure within it.
Currently I have tried each of these:
My end result for this scenario should be mthlyRevEnd = 12/31/2020.
What am I missing? Any help is appreciated.
Solved! Go to Solution.
Hi @NeilL ,
First create a calendar table.(Be sure the table contains enough dates you need for calculation)
Modify the measure to below:
mthlyRevEnd = ENDOFMONTH(DATEADD(calendar table[estimatedclosedate],10,MONTH))
Dont use .date for calculation,and be sure that your calculation dont exceed your calendar date.
Here is a blog about time intelligence,hope it would help.
@VasTg
Thanks for the quick reply. I am not trying to get the end of year, only the end of the month; it just so happens the example I provided in the initial post falls on 12/31/2020.
Better examples of dates I might encounter:
Est...date = 2/12/2020
Duration = 6 months
mthlyRevBegin = 4/1/2020
mthlyRevEnd = 9/30/2020
Est...date = 3/14/2020
Duration = 14 months
mthlyRevBegin = 5/1/2020
mthlyRevEnd = 6/30/2021
Hi @NeilL ,
First create a calendar table.(Be sure the table contains enough dates you need for calculation)
Modify the measure to below:
mthlyRevEnd = ENDOFMONTH(DATEADD(calendar table[estimatedclosedate],10,MONTH))
Dont use .date for calculation,and be sure that your calculation dont exceed your calendar date.
Here is a blog about time intelligence,hope it would help.
User | Count |
---|---|
96 | |
85 | |
77 | |
66 | |
63 |
User | Count |
---|---|
110 | |
96 | |
96 | |
67 | |
59 |