Forum Discussion

OPpB's avatar
OPpB
New Member
7 years ago

Using DateAdd to compare results

 Hi guys, 

I usually use dateadd function to compare results in some period, to this same period last month, or other months depending on the value that I use in numbers intervals.
Now I'm wondering to know if it is possible to use a What If parameter to choose a value like 10, and this show in a graph all the values from last 10 months.
I am using a Date slicer to choose the period. 

In the picture above you can see my problem, using the date slicer I am able to know how is my revenue now and how it was four months ago in the same period, but I would like to see in this graph the other months, in this case, October, November and December.

The dax function I'm using is

 

Rev.= Calculate([Revenue];DATEADD(Calendar[Date];-[N Value];MONTH))

2 Replies

  • OPpB what is your expectation? You want to see # of months in bar graph based on selection in the slicer ?

    • OPpB's avatar
      OPpB
      New Member

      parry2k Yes, if I choose N=4 I want to see the last four months results no only one, if I use this formula CALCULATE ([Revenue];DATESINPERIOD('Calendar'[Date];MAX('Calendar'[Date]);-[N Value];MONTH)) I will have this.

      That is what I want, but using this formula the Revenue that I get in the graph is the revenue from the entire month instead the revenue between the two dates that I've selected.