Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
OPpB
New Member

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. 

image.png

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 2
parry2k
Super User
Super User

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



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@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.
asdasdas.JPG

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.

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.